Reputation: 160
I am trying to fix an issue where it seems that SoapClient is not inserting the parameters into the SOAP request.
The simple test fails to a web service running on the same server as the website, which is PHP 5.3.13 on Windows 8 Server and IIS 7.1. This had been working as recently as two days ago, but is now failing. I am not aware of any changes to the server installation other than updates.
function simpleTest(){
$client = new SoapClient("http://server-sql:78/PCIWCTest/Service1.svc?wsdl", array( "trace" => 1 ));
$result = $client->__soapCall("GetData",
array('GetData'=> array('parameters'=> 'Hello')),
array('soapaction' => 'http://server-sql:78/PCIWCTest/GetData'));
$requXML = $client->__getLastRequest();
$respXML = $client->__getLastResponse();
debug($requXML);
debug($respXML);
}
The resulting request ($requXML) is:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData/></SOAP-ENV:Body></SOAP-ENV:Envelope>
I am assuming that there should be the string 'Hello' between the
<SOAP-ENV:Body><ns1:GetData/></SOAP-ENV:Body>
tags, right?
I have been working with many different methods during troubleshooting like soap __call with the same results. Server has been restarted. I've tried all I can think and find to try.
Has anybody seen this before or have an idea?
Upvotes: 2
Views: 5246
Reputation: 160
In this case, I discovered that the parameter I was sending was not named exactly as the parameter in the Web Service code. By changing the above:
array('GetData'=> array('parameters'=> 'Hello')),
to:
array('GetData'=> array('value'=> 'Hello')),
the call worked normally and the parameter was no longer blank! I don;t know if this behavior is unique to this situation, but in my limited experience, I have not seen a situation where it mattered what the parameter was named on the other end.
At any rate, issue is solved. Hope this helps someone!
Upvotes: 3