473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SoapClient not sending proper SOAP requests -- how do I correct this?

Hi All,

I've got the following PHP code:

$service = new SoapClient("http://www.webservicex.net/length.asmx?
wsdl");
$result = $service->ChangeLengthUnit(10,"Inches","Centimeters");
var_dump($result);
It returns:

object(stdClass)#2 (1) {
["ChangeLengthUnitResult"]=>
float(0)
}

If you manually go to http://www.webservicex.net/length.as...angeLengthUnit
and try the operation yourself, you'll see that it returns 2.54.

I used Wireshark to see what SOAP request was actually being sent, and
here's what I found:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://www.webserviceX.NET/">
<SOAP-ENV:Body>
<ns1:ChangeLengthUnit/>
<param1>Inches</param1>
<param2>Centimeters</param2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This isn't right! Here's what the request *should* look like. The XML
namespaces are different, but that's ok; the problem is the content of
the Body element.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ChangeLengthUnit xmlns="http://www.webserviceX.NET/">
<LengthValue>1</LengthValue>
<fromLengthUnit>Inches</fromLengthUnit>
<toLengthUnit>Centimeters/ChangeLengthUnit>
</soap:Body>
</soap:Envelope>

Windows XP Pro, IIS 5.1, and PHP 5.2.1 -- is there a bug that was
resolved in later versions of PHP? Or am I missing something?

-Josh

Aug 31 '07 #1
3 6380
On Aug 31, 9:54 am, Joshua Beall <joshbe...@gmail.comwrote:
Hi All,

I've got the following PHP code:

$service = new SoapClient("http://www.webservicex.net/length.asmx?
wsdl");
$result = $service->ChangeLengthUnit(10,"Inches","Centimeters");
var_dump($result);

It returns:

object(stdClass)#2 (1) {
["ChangeLengthUnitResult"]=>
float(0)

}

If you manually go tohttp://www.webservicex.net/length.asmx?op=ChangeLengthUnit
and try the operation yourself, you'll see that it returns 2.54.

I used Wireshark to see what SOAP request was actually being sent, and
here's what I found:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:ns1="http://www.webserviceX.NET/">
<SOAP-ENV:Body>
<ns1:ChangeLengthUnit/>
<param1>Inches</param1>
<param2>Centimeters</param2>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This isn't right! Here's what the request *should* look like. The XML
namespaces are different, but that's ok; the problem is the content of
the Body element.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ChangeLengthUnit xmlns="http://www.webserviceX.NET/">
<LengthValue>1</LengthValue>
<fromLengthUnit>Inches</fromLengthUnit>
<toLengthUnit>Centimeters/ChangeLengthUnit>
</soap:Body>
</soap:Envelope>

Windows XP Pro, IIS 5.1, and PHP 5.2.1 -- is there a bug that was
resolved in later versions of PHP? Or am I missing something?

-Josh
Are you pointing to the correct WSDL for your request? It looks like
it isn't receiving the correct format the is expected by the server.

Aug 31 '07 #2
On Aug 31, 12:25 pm, ELINTPimp <smsi...@gmail.comwrote:
Are you pointing to the correct WSDL for your request? It looks like
it isn't receiving the correct format the is expected by the server.
That's the correct WSDL link -- you can verify yourself by going to
http://www.webservicex.net/length.asmx?wsdl

Having said that, the only place I include link that is in the
SoapClient constructor -- is it support to be somewhere else as well?

Aug 31 '07 #3
On Aug 31, 12:33 pm, Joshua Beall <joshbe...@gmail.comwrote:
Having said that, the only place I include link that is in the
SoapClient constructor -- is it support to be somewhere else as well?
Is that record typo density, I wonder? Anyway, that's supposed to be
"...I include that link is..." and "-- is it supposed to be..."

Aug 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: aws.steve | last post by:
I am trying to get my first Soap based website to work on my Windows 2000 server with IIS 5. The code used to create the client is as follows: set SoapClient = CreateObject("MSSOAP.SoapClient")...
0
by: martin | last post by:
I'm trying to implement a simple web service client using the SoapClient class. I need to add support for new web services later without restarting, let alone recompiling, my application and so...
0
by: Jacques Lebastard | last post by:
Hi there, I'm new to the SOAP PHP5 extension. It works fine for web service methods that returns basic types (string,int,...). However, for methods that return an object of a class I defined, I...
1
by: Dheepu Kumar1 | last post by:
We are using WSDL in soapclient to access the java web service.The soapclient request is not formed as required by the service. Namespace is not included in one ComplexType element(<GSTBTReq>) in...
0
by: Florian Laws | last post by:
Hello, to work around an interoperability problem with the PHP5 SOAP extension, I'd like to modify the generate XML SOAP request. (as described in...
1
by: Sergei Riaguzov | last post by:
Hi, How can I catch errors produced by SOAP server with SoapClient? The first thing which comes in mind is eval() but maybe there is a better way? The server is sending some fault information...
3
by: broersen | last post by:
Hello, Can someone tell how to create a header within a SOAP Message for sending wwith HTTP Client? And how to use x509 certificate with this HTTP Request? <SOAP-ENV:Envelope>...
1
by: broersen | last post by:
Hello, Can someone tell how to create a header within a SOAP Message for sending wwith HTTP Client? And how to use x509 certificate with this HTTP Request? <SOAP-ENV:Envelope>...
1
by: Taras_96 | last post by:
Hi everyone, I'm trying to use PHP's built in SoapClient class. It seems really easy to use, but am unsure of how to handle errors upon construction of the SoapClient object. If either the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.