Solved

PHP Soap Parameter issue

Posted on 2010-08-27
7
1,187 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHPStorm debugging issues 1 46
Wordpress errors showing up, hacked? 4 35
google analytics in wordpress 4 35
Number of hours between date in DB and now 8 18
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 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