Link to home
Start Free TrialLog in
Avatar of vertex_paul
vertex_paulFlag for United States of America

asked on

PHP Soap Parameter issue

I am attempting to connect to a SOAP service and am unsuccessful in retrieving the data. I get the structure but no data. The person at the provider has sent me the corrections to my request however, I am not sure how to change my request to accomplish this. Below is my code and the request I am sending and the corrected request they are suggesting. Can anyone help with how to modify?

Thanks!

CODE:

$URL = 'http://addressof?wsdl';

$client = new SoapClient(null, array(
    "location" => $URL,
        "uri"      => "http://givenbyprovider",
        "style"    => SOAP_RPC,
        "use"      => SOAP_ENCODED
    ));

$return = $client->__soapCall("getEsnInfo",
   array('esn' => '12345678')
);


MYREQUEST:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://xxxx"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getEsnInfo>
<param0 xsi:type="xsd:string">12345678</param0>
</ns1:getEsnInfo></SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SUGGESTED REQUEST:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://xxxx"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:getEsnInfo>
<param0 > <esn xsi:type="xsd:string">12345678</esn></param0>
</ns1:getEsnInfo></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Avatar of Bryan Butler
Bryan Butler
Flag of United States of America image

Is the only difference the following line?

<param0 > <esn xsi:type="xsd:string">12345678</esn></param0>
vs.
<param0 xsi:type="xsd:string">12345678</param0>

I would think this is an error on their side since all the references I find (searching for [SoapClient param0 "xml version"]), such as http://herongyang.com/PHP/php_soap_4.html , show that your syntax is correct.  It may be a "service" specific issue. (such as in this post http://www.sugarcrm.com/forums/showthread.php?t=42690 )

What service are you trying this with?
Avatar of vertex_paul

ASKER

What do you mean by service?
When you say "I am attempting to connect to a SOAP service", what is the server.  IIS, Apache?  What API?  Etc?  (stuff your provider can tell you)


http://en.wikipedia.org/wiki/Web_service
It is on Apache-Coyote/1.1
Stated by the developer it is a pure soap service.

In the initial posting here their claim is that if the request if formatted properly it is working correctly. However, in using the Soap Client in PHP5 I do not understand how to format my request in the way asked by the developer.
issue resolved by adding the following:

$return = $client->__soapCall("getEsnInfo",
  array('param0',  array('esn' => '12345678'))
ASKER CERTIFIED SOLUTION
Avatar of Bryan Butler
Bryan Butler
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nice job.