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

Passing XML argument via service description - a bug?

Expand Messages
  • Fred Toth
    Hi all, When passing an XML payload as a string using normal SOAP::Lite client calls, the XML gets encoded so that it looks like content. For example,
    Message 1 of 2 , Nov 27, 2001
    • 0 Attachment
      Hi all,

      When passing an XML payload as a string using normal SOAP::Lite
      client calls, the XML gets encoded so that it looks like content.
      For example, '<' gets converted to <, etc.

      However, it appears that when doing the same thing via a service description,
      the XML does NOT get encoded. (I'm using version 0.52 on linux, but this
      also happened in 0.50.)

      Is this a bug? Or lack of understanding on my part? (There's lots of that!)

      Here's the code (I won't bother with the WSDL file. Suffice it to say that
      the sXML argument is typed as a string):

      use SOAP::Lite +trace => 'debug';
      use constant TESTWSDL => 'file:./test.wsdl';
      my $xml = <<EOF;
      <test>
      <howdy_to>Matthew</howdy_to>
      </test>
      EOF
      my $result = SOAP::Lite
      -> service(TESTWSDL)
      -> SaveXML($xml);
      print $result;

      And here's the resulting message body:

      <SOAP-ENV:Body><namesp1:SaveXML xmlns:namesp1="MySaveXML"><sXML
      xsi:type="xsd:string"><test>
      <howdy_to>Matthew</howdy_to>
      </test>
      </sXML></namesp1:SaveXML></SOAP-ENV:Body>

      Notice that the XML argument is dropped into the body with no
      encoding.

      If I change the above code to do a normal SOAP::Lite proxy/uri call, the
      XML gets encoded properly.

      If anyone can shed some light on this, I'd appreciate it.

      Thanks,

      Fred Toth
    • Paul Kulchenko
      Hi, Fred! ... I would say that s a bug. It depends however on your WSDL description. When you have
      Message 2 of 2 , Nov 27, 2001
      • 0 Attachment
        Hi, Fred!

        --- Fred Toth <ftoth@...> wrote:
        > When passing an XML payload as a string using normal SOAP::Lite
        > client calls, the XML gets encoded so that it looks like content.
        > For example, '<' gets converted to <, etc.
        >
        > However, it appears that when doing the same thing via a service
        > description,
        > the XML does NOT get encoded. (I'm using version 0.52 on linux, but
        > this also happened in 0.50.)
        >
        > Is this a bug? Or lack of understanding on my part? (There's lots
        > of that!)
        I would say that's a bug. It depends however on your WSDL
        description. When you have

        <message name="echoStringRequest">
        <part name="a" type="string" />
        </message>

        your string will encoded. If you have:

        <message name="echoStringRequest">
        <part name="a" type="xsd:string" />
        </message>

        it will not.

        The same thing happens with non-service code also:

        SOAP::Data->type(string => '<>'); # encodes data, whereas
        SOAP::Data->type('xsd:string' => '<>'); # doesn't

        I think that's something that should be changed (at least for service
        code, because both are valid and equivalent forms).

        Best wishes, Paul.

        __________________________________________________
        Do You Yahoo!?
        Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
        http://geocities.yahoo.com/ps/info1
      Your message has been successfully submitted and would be delivered to recipients shortly.