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

Empty results with SOAP::Lite - why?

Expand Messages
  • Patrick Schoenfeld
    Hi, I m currently trying to train myself in using SOAP::Lite and having problems with the most basic use. Unfortunately I must confess that I don t know much
    Message 1 of 6 , Jul 27, 2009
    • 0 Attachment
      Hi,

      I'm currently trying to train myself in using SOAP::Lite
      and having problems with the most basic use. Unfortunately
      I must confess that I don't know much about SOAP, except
      rough basics.

      OK, lets consider the following script:
      use SOAP::Lite +trace => 'debug';
      $uri = 'http://packages.qa.debian.org/cgi-bin/soap-alpha.cgi';
      $soap = SOAP::Lite->new();
      $soap->proxy($uri);
      $soap->default_ns($uri);
      $ver = $soap->version;
      # This returns nothing, why?

      The SOAP interface above does not have a namespace.
      According to the SOAP dump, the interface seems to answer the
      command with the right answer (its the same as a similar script written
      in python returns):

      <SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><versionResponse
      id="o8c9dfe0"
      xsi:type="xsd:string">0.1.2066</versionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

      So from the code above, I expect $ver to be 0.1.2066, but its empty.
      Can somebody enlighten me, what I am doing wrong? Pointers
      to the documentation welcome, because I didn't find anything,
      which helps me.

      Thanks and best Regards,
      Patrick
    • Patrick Schoenfeld
      Hi, ... thanks for trying to help, but I can t see how this should help? The remote command is version(), not versionRepsonse, so obviously your proposal leads
      Message 2 of 6 , Jul 27, 2009
      • 0 Attachment
        Hi,

        On Mon, Jul 27, 2009 at 10:14:43AM -0500, JONES, ROBERT E CTR USAF AETC TTMS/TTMS wrote:
        > Try $ver = $soap->versionResponse->result; or something like that. 5min answer.

        thanks for trying to help, but I can't see how this should help?
        The remote command is version(), not versionRepsonse, so obviously
        your proposal leads to a server error.

        Thanks and best Regards,
        Patrick

        P.S. I'm subscribed to the list, no private replies neccessary :)
      • Thurn, Martin (IS)
        RTFM in http://search.cpan.org/~mkutter/SOAP-Lite-0.710.08/lib/OldDocs/SOAP/Lite.pm#IN/OUT,_OUT_PARAMETERS_AND_AUTOBINDING and look at the examples in
        Message 3 of 6 , Jul 27, 2009
        • 0 Attachment
          RTFM in http://search.cpan.org/~mkutter/SOAP-Lite-0.710.08/lib/OldDocs/SOAP/Lite.pm#IN/OUT,_OUT_PARAMETERS_AND_AUTOBINDING and look at the examples in http://cpansearch.perl.org/src/MKUTTER/SOAP-Lite-0.710.08/examples/

          The return value from a SOAP call is NOT the plain return value of the Perl function, it is some kind of SOAP object on which you have to call the result() method.

           - - Martin


          From: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] On Behalf Of Patrick Schoenfeld
          Sent: Monday, July 27, 2009 11:22
          To: soaplite@yahoogroups.com
          Subject: Re: [soaplite] Empty results with SOAP::Lite - why?

           
          Hi,

          On Mon, Jul 27, 2009 at 10:14:43AM -0500, JONES, ROBERT E CTR USAF AETC TTMS/TTMS wrote:
          > Try $ver = $soap->versionResponse->result; or something like that. 5min answer.

          thanks for trying to help, but I can't see how this should help?
          The remote command is version(), not versionRepsonse, so obviously
          your proposal leads to a server error.
        • Joe Hourcle
          ... Normally, with RPC-encoded, the response is a struct, not a string, so inside the SOAP body, you d see something like:
          Message 4 of 6 , Jul 27, 2009
          • 0 Attachment
            On Mon, 27 Jul 2009, Patrick Schoenfeld wrote:

            > Hi,
            >
            > I'm currently trying to train myself in using SOAP::Lite
            > and having problems with the most basic use. Unfortunately
            > I must confess that I don't know much about SOAP, except
            > rough basics.
            >
            > OK, lets consider the following script:
            > use SOAP::Lite +trace => 'debug';
            > $uri = 'http://packages.qa.debian.org/cgi-bin/soap-alpha.cgi';
            > $soap = SOAP::Lite->new();
            > $soap->proxy($uri);
            > $soap->default_ns($uri);
            > $ver = $soap->version;
            > # This returns nothing, why?
            >
            > The SOAP interface above does not have a namespace.
            > According to the SOAP dump, the interface seems to answer the
            > command with the right answer (its the same as a similar script written
            > in python returns):
            >
            > <SOAP-ENV:Envelope
            > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
            > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
            > xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
            > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><versionResponse
            > id="o8c9dfe0"
            > xsi:type="xsd:string">0.1.2066</versionResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
            >
            > So from the code above, I expect $ver to be 0.1.2066, but its empty.
            > Can somebody enlighten me, what I am doing wrong? Pointers
            > to the documentation welcome, because I didn't find anything,
            > which helps me.

            Normally, with RPC-encoded, the response is a struct, not a string, so
            inside the SOAP body, you'd see something like:

            <versionResponse>
            <version xsi:type="xsd:string> ... </version>
            </versionResponse>

            As for the 'result()' comment from earlier -- unless you're using
            autodispatch, SOAP::Lite returns a SOAP::SOM object, not the response, so
            you'd have to call result() on the object to get the value.

            (in your case, I gave it a quick test, and it came up empty -- I was able
            to call 'body' on it, and got back:

            { 'versionResponse' => '0.1.2066' }

            -Joe
          • Patrick Schoenfeld
            Hi Joe, ... thanks for enlightening me. I guess I need to learn more about SOAP basics, obviously. ... Yeah, so far I understood it. I missed that part from
            Message 5 of 6 , Jul 27, 2009
            • 0 Attachment
              Hi Joe,

              On Mon, Jul 27, 2009 at 11:56:56AM -0400, Joe Hourcle wrote:
              > Normally, with RPC-encoded, the response is a struct, not a string, so
              > inside the SOAP body, you'd see something like:
              >
              > <versionResponse>
              > <version xsi:type="xsd:string> ... </version>
              > </versionResponse>

              thanks for enlightening me. I guess I need to learn more about SOAP
              basics, obviously.

              > As for the 'result()' comment from earlier -- unless you're using
              > autodispatch, SOAP::Lite returns a SOAP::SOM object, not the
              > response, so you'd have to call result() on the object to get the
              > value.

              Yeah, so far I understood it. I missed that part from the paste-
              After the commment would have been the following line:

              print $ver->result, "\n";

              > (in your case, I gave it a quick test, and it came up empty -- I was
              > able to call 'body' on it, and got back:
              >
              > { 'versionResponse' => '0.1.2066' }

              Ah, so this is specific to the encoding of the SOAP data, as you
              said above. So I will now investigate a bit, if there are possible
              settings to change that behaviour (although its probably okay
              to access data this way - just out of interest).

              Best Regards,
              Patrick
            • Joe Hourcle
              ... It s not an issue with SOAP, it s an issue with RPC/encoded. It s possible that it s allowed in document/literal. I still use RPC/encoded for everything,
              Message 6 of 6 , Jul 27, 2009
              • 0 Attachment
                On Mon, 27 Jul 2009, Patrick Schoenfeld wrote:

                > Hi Joe,
                >
                > On Mon, Jul 27, 2009 at 11:56:56AM -0400, Joe Hourcle wrote:
                >> Normally, with RPC-encoded, the response is a struct, not a string, so
                >> inside the SOAP body, you'd see something like:
                >>
                >> <versionResponse>
                >> <version xsi:type="xsd:string> ... </version>
                >> </versionResponse>
                >
                > thanks for enlightening me. I guess I need to learn more about SOAP
                > basics, obviously.

                It's not an issue with SOAP, it's an issue with RPC/encoded. It's
                possible that it's allowed in document/literal. I still use RPC/encoded
                for everything, so I'm not sure.


                > Ah, so this is specific to the encoding of the SOAP data, as you
                > said above. So I will now investigate a bit, if there are possible
                > settings to change that behaviour (although its probably okay
                > to access data this way - just out of interest).

                So long as the service doesn't change their response format, it should be
                fine. I guess it's possible for later SOAP specs to change things, but
                the only issue I've ever had to deal with was how nulls were serialized.

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