#37126 [NEW]: Invalid conversion from php string to xsd:long

From: Date: Tue, 18 Apr 2006 18:29:59 +0000
Subject: #37126 [NEW]: Invalid conversion from php string to xsd:long
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95949@lists.php.net to get a copy of this message
From:             karthikm at yahoo-inc dot com
Operating system: Windows XP, Linux
PHP version:      5.1.2
PHP Bug Type:     SOAP related
Bug description:  Invalid conversion from php string to xsd:long

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 bug report at http://bugs.php.net/?id=37126&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37126&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37126&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37126&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37126&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=37126&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37126&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37126&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37126&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37126&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37126&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=37126&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=37126&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37126&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37126&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37126&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37126&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37126&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37126&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37126&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37126&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#95949) next »