Re: SoapServer and integer types question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Btw, this example uses SoapClient, but it works just the same way for SoapServer.

- David


On 04.02.2010, at 12:07, David Zülke wrote:

The long overflows because ext/soap maps it to an int, and you're on a 32bit arch. You can easily fix that problem by using a custom type mapper to override the internal handling of {http://www.w3.org/2001/XMLSchema }long:

function to_long_xml($longVal) {
 return '<long>' . $longVal . '</long>';
}
function from_long_xml($xmlFragmentString) {
 return (string)strip_tags($xmlFragmentString);
}
$client = new SoapClient('http://acme.com/products.wsdl', array(
 'typemap' => array(
   array(
     'type_ns' => 'http://www.w3.org/2001/XMLSchema',
     'type_name' => 'long',
     'to_xml' => 'to_long_xml',
     'from_xml' => 'from_long_xml',
   ),
 ),
));

That's from my presentation "The State of SOAP in PHP" I gave at a couple of conferences over the last few months, here is info and slides from the last time at the PHPBenelux conference (including a trick using the same method to achieve handling of DateTime objects):
http://www.slideshare.net/Wombert/the-state-of-soap-in-php-3029206
http://joind.in/talk/view/1243

Hope that helps,

David


On 26.01.2010, at 18:21, Bruce Bailey wrote:


Hi

I'm using the SoapServer class (in PHP5.2.3) and noticing what seems like incorrect behavior.

When I have 10 digit (or greater) integer values returned from the SoapServer, they seem to overflow.

For example:

Schema type (from WSDL): xs:long (or xs:int or xs:integer) Returned value (from network trace): <value>2147483647</ value>

Expected value: <value>3605736641</value>


Is this correct behavior?

I find that if I use xs:decimal for the type, I get my expected value back from SoapServer, but I'm concerned that there are unexpected consequences waiting for me in the future.

What have other people done in this type of situation?

Thanks in advance,

Bruce
		 	   		
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/196390710/direct/01/


Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux