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

Re: [soaplite] Passing XML strings as arguments

Expand Messages
  • Don Seiler
    ... Sure. I have a function called SavePage(), taking 5 params. These are username, password, pageId, pageTitle, and pageContent. The pageContent field is
    Message 1 of 6 , Feb 1, 2006
    • 0 Attachment
      Byrne Reese wrote:
      > Can you send to the list a code sample, and a trace of the request and
      > response? That will help us to better understand the problem you are
      > having and come up with a solution.

      Sure. I have a function called SavePage(), taking 5 params. These are
      username, password, pageId, pageTitle, and pageContent. The pageContent
      field is going to be an XML string, something like "<foo><bar
      name="boo"/></foo>". When I call the function, I see the XML in the
      trace, but when I echo the parameter in the perl function, the string is
      empty.

      Here is the SavePageRequest definition in my WSDL file:

      <message name="SavePageRequest">
      <part name="username" type="xsd:string"/>
      <part name="password" type="xsd:string"/>
      <part name="id" type="xsd:string"/>
      <part name="title" type="xsd:string"/>
      <part name="content" type="xsd:string"/>
      </message>

      I'm using rpc/encoded style, fwiw.

      Here is the function in my perl class:

      sub SavePage {
      my $self = shift;
      my ($username, $password, $id, $pageTitle, $pageContent) = @_;
      my $logger = get_logger();
      $logger->debug("pageContent is $pageContent");

      my $response = "";
      return $response;
      }

      My log file shows this:

      pageContent is

      The trace shows the SOAP envelope for the SavePage call, with the XML:

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><namesp1:SavePage
      xmlns:namesp1="uri:FooSoap"><username
      xsi:type="xsd:string">dts</username><password
      xsi:type="xsd:string">passdtsword</password><id
      xsi:type="xsd:string">3</id><title xsi:type="xsd:string">Test
      Title</title><content
      xsi:type="xsd:string"><foo><bar>hiho</bar></foo></content></namesp1:SavePage></SOAP-ENV:Body></SOAP-ENV:Envelope>

      As I said, normal strings and ints come through fine. Just this XML
      string that is a problem.

      I found it surprising that you should even ask for an example. Does
      this not happen to you? I'm on SOAP::Lite 0.60

      Don.

      >
      > Don Seiler wrote:
      >
      >>-----BEGIN PGP SIGNED MESSAGE-----
      >>Hash: SHA1
      >>
      >>Don Seiler wrote:
      >>
      >>>I'm writing a SOAP server (CGI), and some of the functions need to take
      >>>in XML strings as arguments. However it looks like the SOAP server is
      >>>removing the XML string entirely, so when I check in my function the
      >>>entire parameter is just null (I get uninitialized warnings when trying
      >>>to use it).
    • Don Seiler
      ... Guess what. I upgraded to 0.67 and it works fine now. Sorry about that! Don.
      Message 2 of 6 , Feb 1, 2006
      • 0 Attachment
        Don Seiler wrote:
        > I found it surprising that you should even ask for an example. Does
        > this not happen to you? I'm on SOAP::Lite 0.60

        Guess what. I upgraded to 0.67 and it works fine now.

        Sorry about that!

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