in reply to Re: Force integer to occupy 64 bits (bytes)
in thread Force integer to occupy 64 bits

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).
  • Comment on Re^2: Force integer to occupy 64 bits (bytes)

Replies are listed 'Best First'.
Re^3: Force integer to occupy 64 bits (bytes)
by Anonymous Monk on Jul 29, 2013 at 09:02 UTC

    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.