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