in reply to Force integer to occupy 64 bits

has to be a 64 bit integer (it gives error if I provide a 32 bit integer)

What is that? You see SOAP sends bytes, so what kind of bytes does it want you to send for the 64-bit integer?

Does it like this string? sprintf '%09x', 12;

  • Comment on Re: Force integer to occupy 64 bits (bytes)

Replies are listed 'Best First'.
Re^2: Force integer to occupy 64 bits (bytes)
by yuhang91 (Initiate) on Jul 29, 2013 at 11:46 UTC
    I was mistakenly blaming Perl for my problem. It seems that the real cause lies within the XML generated by the SOAP call:
    <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="h +ttp://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.x +mlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soa +p/envelope/"><soap:Body><loadPathwayForId><identifier xsi:type="xsd:i +nt">68886</identifier></loadPathwayForId></soap:Body></soap:Envelope>

    I just have to somehow get xsi:type to say "xsd:long" instead of "xsd:int".
        Thanks for the thorough reply!

        I used SOAP::Data -> name(identifier => $identifier ) -> type('xsd:long'); and obliterated the type error.

        Unfortunately, now it seems I'm getting another error from SOAP::Lite when the returned XML is too long... I am stuck with SOAP since that is the only way for me to retrieve the data I want. I'll check out the other SOAP modules that you proposed, maybe they will better handle large amount of data!
Re^2: Force integer to occupy 64 bits (bytes)
by yuhang91 (Initiate) on Jul 29, 2013 at 08:55 UTC
    It wants bytes as long (int64) type. Giving it sprintf '%09x', 12; gives me the error org.xml.sax.SAXException: Bad types (class java.lang.String -> long). Similarly, when I give it a number that can be represented as int32 (not big enough for int64), it gives org.xml.sax.SAXException: Bad types (int -> long).

      It wants bytes as long (int64) type.

      But that isn't bytes, it doesn't say byte order (little or big endian). Have you see pack?
      pack'q<', $d64
      pack 'q>', $d64

        Thanks for the suggestions, really appreciate it! I've tried using pack but the returned data type still doesn't match that required by the web service, regardless of byte order. I get the error org.xml.sax.SAXException: Bad types (class [B -> long).

        So far, the only case where I don't receive the "Bad types" error is when I supply an integer greater than 2,147,483,647, which is the maximum value of a 32int. It seems that Perl is dynamically assigning the size of the integer depending on the value and I have no control over it. The web service, on the other hand, is in Java, and doesn't seem to accept anything other than the long that it demands!

        I guess I will explore other options to avoid this challenge.