#37126 [Com]: Invalid conversion from php string to xsd:long
ID: 37126
Comment by: karthikm at yahoo dot com
Reported By: karthikm at yahoo-inc dot com
Status: No Feedback
Bug Type: SOAP related
Operating System: Windows XP, Linux
PHP Version: 5.1.2
New Comment:
Checked in all version upto 6.0 releases from http://snaps.php.net/ and
with the php_soap.dlls gotten from
http://pecl4win.php.net/ext.php/php_soap.dll.
All versions seem to have the same issue.
Previous Comments:
------------------------------------------------------------------------
[2006-04-26 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2006-04-18 21:25:17] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.1-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.1-win32-latest.zip
------------------------------------------------------------------------
[2006-04-18 18:29:59] karthikm at yahoo-inc dot com
Description:
------------
longs represented as php string variables do not get converted
correctly to soap parameter declared as xsd:long. But, longs
represented as php numbers work correctly.
Ex:
$idValue = '572527773301459002' shows up incorrectly as
<ns1:ID>2147483647</ns1:ID>
where as,
$idValue = 572527773301459002 shows up correctly as
<ns1:ID>572527773301459010</ns1:ID>
Reproduce code:
---------------
<?php
$client = new SoapClient(
"file:///C:/temp/phpbug/MyService.wsdl",
array( "trace" => true,
"exceptions" => true,
"location" => "http://localhost:8144/MyService",
"connection_timeout"=>10)
);
$idValue = '572527773301459002';
$obj = array(
'ID' => $idValue,
);
$retObj = $client->__soapCall(
'operation',
array( $obj )
);
?>
=======MyService.wsdl=======
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
xmlns:tns="http://mycompany.com"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://mycompany.com">
<wsdl:types>
<xsd:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://mycompany.com">
<xsd:element name="operation">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:long"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="operationResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1"
name="out" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="operationResponse">
<wsdl:part element="tns:operationResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="operationRequest">
<wsdl:part element="tns:operation" name="parameters"/>
</wsdl:message>
<wsdl:portType name="MyService">
<wsdl:operation name="operation">
<wsdl:input message="tns:operationRequest"
name="operationRequest"/>
<wsdl:output message="tns:operationResponse"
name="operationResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyServiceHttpBinding" type="tns:MyService">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="operation">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="operationRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="operationResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyServiceService">
<wsdl:port binding="tns:MyServiceHttpBinding"
name="MyService">
<wsdlsoap:address location="https://localhost/MyService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://mycompany.com">
<SOAP-ENV:Body>
<ns1:operation>
<ns1:ID>572527773301459010</ns1:ID>
</ns1:operation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://mycompany.com">
<SOAP-ENV:Body>
<ns1:operation>
<ns1:ID>2147483647</ns1:ID>
</ns1:operation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37126&edit=1
Thread (3 messages)