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

outputxml usage

Expand Messages
  • Borislav Dobroslavov
    Hi, I have a problem using outputxml() from the SOAP::Lite package. The documentation says: outputxml() Lets you specify the kind of output from all method
    Message 1 of 4 , Mar 27 7:49 AM
    • 0 Attachment
      Hi,

      I have a problem using outputxml() from the SOAP::Lite package. The
      documentation says:

      outputxml()
      Lets you specify the kind of output from all method calls. If true, all
      methods will return unprocessed, raw XML code. You can parse it with XML::Parser,
      SOAP::Deserializer or any other appropriate module.

      I tried to use it like this:

      my $res = SOAP::Lite
      -> uri("...")
      -> proxy("...")
      -> outputxml("1")
      -> myMethod();

      This results in a syntax error. The documentation is not very clear about
      the way this function should be used. Could you give me an example of the
      correct usage?

      Thanks.
      Borislav

      --
      Sent through GMX FreeMail - http://www.gmx.net
    • Paul Kulchenko
      Hi, Borislav! This code works as expected and outputs XML: use SOAP::Lite; my $res = SOAP::Lite - uri( Echo ) -
      Message 2 of 4 , Mar 27 8:53 AM
      • 0 Attachment
        Hi, Borislav!

        This code works as expected and outputs XML:

        use SOAP::Lite;

        my $res = SOAP::Lite
        -> uri("Echo")
        -> proxy("http://services.soaplite.com/echo.cgi")
        -> outputxml("1")
        -> echo();

        print $res;

        What kind of error are you getting? Actually if you just want to
        deserialize your message with specific deserializer you may override
        it. Next version will include examples with DOM
        (XML::DOM)serialization/deserialization.

        Best wishes, Paul.

        --- Borislav Dobroslavov <borislavd@...> wrote:
        > Hi,
        >
        > I have a problem using outputxml() from the SOAP::Lite package. The
        > documentation says:
        >
        > outputxml()
        > Lets you specify the kind of output from all method calls. If true,
        > all
        > methods will return unprocessed, raw XML code. You can parse it
        > with XML::Parser,
        > SOAP::Deserializer or any other appropriate module.
        >
        > I tried to use it like this:
        >
        > my $res = SOAP::Lite
        > -> uri("...")
        > -> proxy("...")
        > -> outputxml("1")
        > -> myMethod();
        >
        > This results in a syntax error. The documentation is not very clear
        > about
        > the way this function should be used. Could you give me an example
        > of the
        > correct usage?
        >
        > Thanks.
        > Borislav
        >
        > --
        > Sent through GMX FreeMail - http://www.gmx.net
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! Auctions - Buy the things you want at great prices.
        http://auctions.yahoo.com/
      • borislavd@gmx.net
        Paul, Let me clarify the problem I was having. Here is the code: my $soap_response = SOAP::Lite - uri( ... ) - proxy( ... ) - outputxml( 1 ) - myMethod();
        Message 3 of 4 , Mar 27 10:40 AM
        • 0 Attachment
          Paul,

          Let me clarify the problem I was having. Here is the code:

          my $soap_response = SOAP::Lite
          -> uri("...")
          -> proxy("...")
          -> outputxml("1")
          -> myMethod();

          if ($soap_response->fault) {
          ...

          This resulted in an error:

          Can't call method "fault" without a package or object reference at
          <...> You used the syntax of a method call, but the slot filled by
          the object reference or package name contains an expression that
          returns a defined value which is neither an object reference nor a
          package name. Something like this will reproduce the error: $BADREF =
          42; process $BADREF 1,2,3; $BADREF->process(1,2,3);

          I tried your example and it worked. My code works if I remove the
          line with '-> outputxml("1")'.

          Regards,
          Borislav
        • Paul Kulchenko
          Hi, Borislav! Right. outputxml() says that method will return UNPARSED xml code and you re willing to do what you want with it, but since it wasn t parsed
          Message 4 of 4 , Mar 27 10:58 AM
          • 0 Attachment
            Hi, Borislav!

            Right. outputxml() says that method will return UNPARSED xml code and
            you're willing to do what you want with it, but since it wasn't
            parsed there is NO WAY to show faultcode, faultstring or to get
            something else for it. This is ALTERNATIVE way to usual processing.
            You got xml code and you are one-to-one with it. No more help from
            SOAP::Lite on it :)). THAT is the reason, because you're trying to
            apply faultstring() method to string that has XML inside, not to the
            object that represent parsed XML. That's the difference. Hope it
            helps.

            Best wishes, Paul.

            --- borislavd@... wrote:
            > Paul,
            >
            > Let me clarify the problem I was having. Here is the code:
            >
            > my $soap_response = SOAP::Lite
            > -> uri("...")
            > -> proxy("...")
            > -> outputxml("1")
            > -> myMethod();
            >
            > if ($soap_response->fault) {
            > ...
            >
            > This resulted in an error:
            >
            > Can't call method "fault" without a package or object reference at
            > <...> You used the syntax of a method call, but the slot filled by
            > the object reference or package name contains an expression that
            > returns a defined value which is neither an object reference nor a
            > package name. Something like this will reproduce the error: $BADREF
            > =
            > 42; process $BADREF 1,2,3; $BADREF->process(1,2,3);
            >
            > I tried your example and it worked. My code works if I remove the
            > line with '-> outputxml("1")'.
            >
            > Regards,
            > Borislav
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            >
            >


            __________________________________________________
            Do You Yahoo!?
            Get email at your own domain with Yahoo! Mail.
            http://personal.mail.yahoo.com/?.refer=text
          Your message has been successfully submitted and would be delivered to recipients shortly.