Solved

PHP Soap Parameter issue

Posted on 2010-08-27
7
1,163 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

746 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

14 Experts available now in Live!

Get 1:1 Help Now