473,785 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Hi All,

I've got the following PHP code:

$service = new SoapClient("htt p://www.webservicex .net/length.asmx?
wsdl");
$result = $service->ChangeLengthUn it(10,"Inches", "Centimeter s");
var_dump($resul t);
It returns:

object(stdClass )#2 (1) {
["ChangeLengthUn itResult"]=>
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:ChangeLeng thUnit/>
<param1>Inche s</param1>
<param2>Centime ters</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:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:soap="htt p://
schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<ChangeLengthUn it xmlns="http://www.webserviceX .NET/">
<LengthValue> 1</LengthValue>
<fromLengthUnit >Inches</fromLengthUnit>
<toLengthUnit>C entimeters/ChangeLengthUni t>
</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 6397
On Aug 31, 9:54 am, Joshua Beall <joshbe...@gmai l.comwrote:
Hi All,

I've got the following PHP code:

$service = new SoapClient("htt p://www.webservicex .net/length.asmx?
wsdl");
$result = $service->ChangeLengthUn it(10,"Inches", "Centimeter s");
var_dump($resul t);

It returns:

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

}

If you manually go tohttp://www.webservicex .net/length.asmx?op= ChangeLengthUni t
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:ChangeLeng thUnit/>
<param1>Inche s</param1>
<param2>Centime ters</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:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:soap="htt p://
schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<ChangeLengthUn it xmlns="http://www.webserviceX .NET/">
<LengthValue> 1</LengthValue>
<fromLengthUnit >Inches</fromLengthUnit>
<toLengthUnit>C entimeters/ChangeLengthUni t>
</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...@gmai l.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
18402
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") But I am getting the following error when the script is run: Microsoft VBScript runtime (0x800A01AD) ActiveX component can't create object: 'MSSOAP.SoapClient'
0
1049
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 generating code using "add web reference" is not an option for me. Anyway, while using the SoapClient.SendRequestResponse() method I keep getting AsynchronousOperationException regardless of which one of my test web services I use and regardless...
0
1179
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 can't access the object, though the SOAP response looks correct. Here the received SOAP message : Response:
1
3608
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 request XML which causes the problem in getting response from the service. Request XML generated by SoapClient: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://abc.com/GBTSTo/GBTSTReq/01"...
0
4756
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 http://www.schlossnagle.org/~george/blog/index.php?/archives/235-Salesforce.com-and-PHP.html ) To acheive this, I subclass SoapClient and overwrite the __doRequest() method. According to the PHP documentation and the article above, the
1
2521
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 and then SoapClient->call() fails with some ugly messages containing PHP code. Is it possible to do something like try {
3
4070
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> <SOAP-ENV:Header> <kai:identificatie> <username> </username
1
1642
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> <SOAP-ENV:Header> <kai:identificatie> <username> </username
1
2898
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 network connection is disabled, false URL is provided, or a malformed WSDL is provided, the constructor produces an error: Fatal error: SOAP-ERROR:
0
9491
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10104
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.