I have some troubles with large integer values and PHP SoapClient class. It seems that SoapClient cannot handle large numeric values - and I can't send a number larger than PHP_INT_MAX (2147483647), even though the SOAP parameter type is "xsd:long".
This is the WSDL specification of the SOAP method I need to call:
<message name="doFinishItemRequest">
<part name="session-handle" type="xsd:string"/>
<part name="finish-item-id" type="xsd:long"/>
<part name="finish-cancel-all-bids" type="xsd:int"/>
<part name="finish-cancel-reason" type="xsd:string"/>
</message>
The value of finish-item-id
is "3599569593
" (a string loaded from MySQL BIG INT type). But it seems that SoapClient is casting it to 32-bit integer.
The SOAP envelope looks like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:AllegroWebApi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:doFinishItem>
<session-handle xsi:type="xsd:string">8a5d261806a4b60a283dabdb092e061a2d46e5d80bcc68bb00_56</session-handle>
<finish-item-id xsi:type="xsd:long">2147483647</finish-item-id>
<finish-cancel-all-bids xsi:type="xsd:int">0</finish-cancel-all-bids>
<finish-cancel-reason xsi:type="xsd:string"></finish-cancel-reason>
</ns1:doFinishItem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
It changed 3599569593 to 2147483647 and the SOAP service is telling me that I'm passing wrong ID.
Is there a workaround? (I can't change the WSDL.)
You haven't shown any PHP code, but casting to float seems to work.
$soapVar = (float)'3599569593';
Or when you send it as parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With