2

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?

2
  • Calling the "GetData" method directly on the client object produces the same problematic result? I assume you're using the __ methods to debug here, right? Commented Jan 4, 2013 at 1:50
  • Yes and yes. $client->(GetData, $params) produces the same result. I have also tried setting types on my params per some advice, and enclosing the params in another array to no avail. Commented Jan 4, 2013 at 14:25

1 Answer 1

3

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.