Solved

PHP Soap Parameter issue

Posted on 2010-08-27
7
1,203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

710 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