Hi, I try to post data from a php to asp IIS server. I use the SOAP class in php5.2.0
the code goes like this:
$params = array(
new SoapParam('Doe','LastName'),
new SoapParam('John','FirstName'),
);
$wsdlurl ="http://pathtofile.com/page.asmx?WSDL";
$client = new SoapClient($wsdlurl,
array(
'trace' => 1,
'exception'=> 1,
'soap_version' => SOAP_1_2,
));
$return = $client->__soapCall("CreateOrder", $params);
echo("<pre>Returning value of __soapCall() call: ".$return."</pre>");
echo("<pre>Dumping request headers:\n" .$client->__getLastRequestHeaders()."</pre>");
echo ("<pre>Dumping request:\n".$client->__getLastRequest()."</pre>");
echo("<pre>Dumping response headers:\n".$client->__getLastResponseHeaders()."</pre>");
echo ("<pre>Dumping response:\n".$client->__getLastResponse()."</pre>");
and here's the result back from their server:
<orders><errors><error><message>Object reference not set to an instance of an object.</message></error></errors></orders>
the answer start good with <orders> so I don't know if it's my xml is not good, or my version of php or the IIS server. If I make I view source my xml look fine
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://pathtoservice/services">
<env:Body>
<ns1:CreateOrder/>
<LastName>Doe</LastName>
<FirstName>John</FirstName>
</env:Body></env:Envelope>
and that's the header I send and receive:
Dumping request headers:
POST /pathto/page.asmx HTTP/1.1
Host: sitetohost.com
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.2.0
Content-Type: application/soap+xml; charset=utf-8; action="http://sitetohost.com/CreateOrder"
Content-Length: 926
Dumping response headers:
HTTP/1.1 200 OK
Date: Tue, 12 Feb 2008 21:41:00 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 544
I'm starting to get lost, I'll try NuSOAP too and always get an error
thank you