Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Encoding of "&" and "<"

Expand Messages
  • Duncan Cameron
    ... SOAP::Lite doesn t automtically recognise the xsd:string value for a type, you simply need to use type = string and the value will be escaped properly
    Message 1 of 3 , Apr 12, 2004
    • 0 Attachment
      On 12-04-2004 at 04:54:10 shahada <shahada@...> wrote:

      >I encountered some weird problems with escaping the "&" (ampersand)
      >and "<" (lesser-than) characters. I am using SOAP-Lite 0.60 and Perl
      >5.8.3, and viewing the encoded form with on_debug. In my Soap Client,
      >whenever I do a:
      >
      >SOAP::Data->new (
      > name => 'ping-text',
      > value => 'hello < world'
      >)
      >
      >I get it encoded as:
      >
      ><ping-text xsi:type="xsd:string">hello < world</ping-text>
      >
      >which is fine. But if I do a:
      >
      >SOAP::Data->new (
      > name => 'ping-text',
      > type => 'xsd:string',
      > value => 'hello < world'
      >)
      >
      >I get it encoded as:
      >
      ><ping-text xsi:type="xsd:string">hello < world</ping-text>
      >
      >which causes my server side to bomb out with a "Application failed
      >during request deserialization:not well-formed (invalid token)" error.
      >
      >Is anybody else seeing this? Why is this, and is there a workaround
      >other than not forcing the type?

      SOAP::Lite doesn't automtically recognise the 'xsd:string' value for a type, you simply need to use
      type => 'string'

      and the value will be escaped properly and given the type that you want:
      xsi:type="xsd:string"

      This applies to the other xsd types, such a base64, too.

      Regards
      Duncan
    Your message has been successfully submitted and would be delivered to recipients shortly.