SoapClient not sending proper SOAP requests -- how do I correct this?
SoapClient not sending proper SOAP requests -- how do I correct this?
am 31.08.2007 15:54:13 von joshbeall
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.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:
Inches
Centimeters
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.
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/soap/envelope/">
1
Inches
Centimeters/ChangeLengthUnit>
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
Re: SoapClient not sending proper SOAP requests -- how do I correct this?
am 31.08.2007 18:25:15 von ELINTPimp
On Aug 31, 9:54 am, Joshua Beall wrote:
> 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:
>
>
>
>
>
> Inches
> Centimeters
>
>
>
> 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.
>
>
>
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
> schemas.xmlsoap.org/soap/envelope/">
>
>
> 1
> Inches
> Centimeters/ChangeLengthUnit>
>
>
>
> 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.
Re: SoapClient not sending proper SOAP requests -- how do I correct this?
am 31.08.2007 18:33:00 von joshbeall
On Aug 31, 12:25 pm, ELINTPimp wrote:
> 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?
Re: SoapClient not sending proper SOAP requests -- how do I correct this?
am 31.08.2007 18:35:50 von joshbeall
On Aug 31, 12:33 pm, Joshua Beall wrote:
> 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..."