 |
 | Webservice not return variables sent to it. |  |
Joined: 02 Jan 2004 |
Posts: 4 |
|
|
 |
Posted: Thu Jan 01, 2004 9:17 pm |
|
 |
 |
 |
 |
I have a .NET webservice. I have successfully written pages to consume it using ASP, ASP.NET, and an HTML page using JaveScript, but I cannot get a PHP page to do so.
I am using NuSOAP, and I know the code is successfully contacting the webservice and returning information, but it does not return the variables I am sending it?!
The webservice is available to the public, so by using the code below, you should get the same results I do.
<?php
require_once('NuSOAP/nusoap-0.6.1/nusoap.php');
$client = new soapclient('http://www.astro-matchmaker.com/aspnet_sample/Simple_Test.asmx?wsdl', 'wsdl');
$param = array('strFirstName'=>'Dana','strLastName'=>'Williams');
$namespace = "urn:ns_www.astromatchmaker.com";
$response = $client->call("test", $param, $namespace);
// Display the request and response
echo '<h2>Request</h2>';
echo '' . htmlspecialchars($client->request, ENT_QUOTES) . '';
echo '<h2>Response</h2>';
echo '' . htmlspecialchars($client->response, ENT_QUOTES) . '';
// if a fault occurred, output error info
if (isset($fault)) {
print "Error: ". $fault;
}
else {
print "no errors";
}
print "<BR>";
print 'The response is:<pre>';
print "</pre><br>";
print(htmlentities($response));
// kill object
unset($client);
?>
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Thu Jan 01, 2004 9:39 pm |
|
 |
 |
 |
 |
Could you correct and test your function call according to the code below ?
$client = new soapclient('http://www.astro-matchmaker.com/aspnet_sample/Simple_Test.asmx?wsdl', 'wsdl');
$proxy = $client->getProxy();
$param = array('strFirstName'=>'Dana','strLastName'=>'Williams');
$namespace = "urn:ns_www.astromatchmaker.com";
$response = $proxy->test($param, $namespace); |
If after all you still don't get the results, I'd recommend you step through the code with debugger.
Also, don't forget to update to nusoap 0.6.3 that comes with phped.
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Sun Jan 04, 2004 5:01 pm |
|
 |
 |
 |
 |
The problem is that according to your WSDL
... operation name="test">
<soap:operation soapAction="ns.www.astromatchmaker.com/test" style="document" />
<input>
<soap:body use="literal" /> |
literal means that you can pass literal parameter, not an array.
I'd recommend you use
<soap:body use="encoded" namespace="http://soapinterop.org/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> |
Have a look at your WSDL.
Best regards,
Dmitri.
|
|
 |
 | |  |
Site Admin
Joined: 13 Jul 2003 |
Posts: 8351 |
|
|
 |
Posted: Sun Jan 04, 2004 6:27 pm |
|
 |
 |
 |
 |
Oh, well,
if you believe literals would add your software a bit more portability and interoperability, great, just go ahead and pass the parameters as you did in a plain text  ...
I think, we need to post it as a FAQ. Really not an obvious stuff , is it ?
Good luck,
Dmitri.
|
|
Joined: 02 Jan 2004 |
Posts: 4 |
|
|
 |
Posted: Sun Jan 04, 2004 6:56 pm |
|
 |
 |
 |
 |
FAQ's??? I think we need to tell the world!!!
Maybe it is because I am new to NuSoap and Webservices, but I'll tell you this, I have never been stuck for so long on a problem, nor have I ever posted a problem to so many forums and received so little feedback. I hate to think of the number of people who will get tripped up by using NuSoap to connect to a .NET webservice.
Anyways, while I did figure out a way to make it work, it was you who found the real answer. Kudos to the master; grasshopper will be forever thankful. 
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT - 5 Hours
Page 1 of 1
|
|
|
|  |