Solved

PHP Soap Parameter issue

Posted on 2010-08-27
7
1,176 Views
Last Modified: 2012-08-13
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>
0
Comment
Question by:vertex_paul
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33545071
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?
0
 
LVL 2

Author Comment

by:vertex_paul
ID: 33545135
What do you mean by service?
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33545273
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Author Comment

by:vertex_paul
ID: 33545468
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.
0
 
LVL 2

Author Comment

by:vertex_paul
ID: 33546301
issue resolved by adding the following:

$return = $client->__soapCall("getEsnInfo",
  array('param0',  array('esn' => '12345678'))
0
 
LVL 16

Accepted Solution

by:
Bryan Butler earned 500 total points
ID: 33546655
From what I see, you can NOT format it any other way than the way you have it.  It is not your choice.  It is the defined by PHP.  One way to check things out it to setup a test server and see.  You will need to find out the specific version of the SOAP software they are running.  "Pure soap" I believe just means they installed whatever SOAP software and didn't change the configuration.  They still have to install a soap framework such as Apache CXF.
0
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 33546675
Nice job.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now