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

Re: [soaplite] proper use of on_faul()?

Expand Messages
  • Duncan Cameron
    ... Because you are using autodispatch, you don t get the SOAP result passed back, you get the value returned by your server method. You need to either not use
    Message 1 of 3 , Dec 27, 2002
    • 0 Attachment
      On 2002-12-26 Daryl Williams wrote:
      >folks,
      >
      >i have searched through the documentation to no avail. their error
      >handling examples use a different calling systax than the script
      >i am trying to improve, to provide better error handling.
      >
      >i've played with several different variations, but none have worked.
      >my latest try was to test the fault() value from my method's response,
      >but this does not seem to work either. actually i would rather use a
      >more glabal approach, like on_fault(), but so far i haven't found the
      >proper usage, given my script's soap calling syntax. perhaps, i am
      >doing something wrong, or there is a better way to do this. or maybe
      >the answer is right under my nose and i can't see it. any help, pointers
      >etc. are welcomed. the code looks something like this:
      >
      >use SOAP::Lite 'autodispatch';
      >sub runsoap
      >{
      > my ($vhost, $service, $method, @arglist) = @_;
      >
      > my $uri = "http://${vhost}:5253/VPSAdmin";
      > my $proxy = "http://${vhost}:5253/";
      >
      > SOAP::Lite->self->uri($uri)->proxy($proxy);
      >
      > my $soap = SOAP::Lite->self;
      > my $objname = "VPSAdmin::${service}";
      > my $obj = $objname->new($vhost);
      >
      > if ( ! defined $obj ) {
      > die_gracefully("null response from server!");
      > }
      >
      > $method_response = $obj->$method($vhost, @arglist);
      > if ( $method_response->fault ) {
      > die_gracefully($method_response->faultstring);
      > }
      >
      > return $method_response;
      >}
      >

      Because you are using autodispatch, you don't get the SOAP result
      passed back, you get the value returned by your server method.

      You need to either not use autodispatch which from your sample
      code looks the most clear approach. As the method names are passed
      as parameters there doesn't seem any benefit in using autodispatch.
      Or use the self() and call() methods to get the SOAP result and
      fault, e.g.

      my $result = SOAP::Lite->self->call->result;
      my $fault = SOAP::Lite->self->call->fault;
      # etc

      Regards,
      Duncan Cameron
    • Daryl Williams
      duncan, thanks for clarifying this. i m still only begining to appreciate all the power and flexibility available in this package and in perl in general...
      Message 2 of 3 , Dec 27, 2002
      • 0 Attachment
        duncan, thanks for clarifying this. i'm still only begining to
        appreciate all the power and flexibility available in this package
        and in perl in general...

        regards,

        daryl


        Duncan Cameron wrote:

        >On 2002-12-26 Daryl Williams wrote:
        >
        >
        >>folks,
        >>
        >>i have searched through the documentation to no avail. their error
        >>handling examples use a different calling systax than the script
        >>i am trying to improve, to provide better error handling.
        >>
        >>i've played with several different variations, but none have worked.
        >>my latest try was to test the fault() value from my method's response,
        >>but this does not seem to work either. actually i would rather use a
        >>more glabal approach, like on_fault(), but so far i haven't found the
        >>proper usage, given my script's soap calling syntax. perhaps, i am
        >>doing something wrong, or there is a better way to do this. or maybe
        >>the answer is right under my nose and i can't see it. any help, pointers
        >>etc. are welcomed. the code looks something like this:
        >>
        >>use SOAP::Lite 'autodispatch';
        >>sub runsoap
        >>{
        >> my ($vhost, $service, $method, @arglist) = @_;
        >>
        >> my $uri = "http://${vhost}:5253/VPSAdmin";
        >> my $proxy = "http://${vhost}:5253/";
        >>
        >> SOAP::Lite->self->uri($uri)->proxy($proxy);
        >>
        >> my $soap = SOAP::Lite->self;
        >> my $objname = "VPSAdmin::${service}";
        >> my $obj = $objname->new($vhost);
        >>
        >> if ( ! defined $obj ) {
        >> die_gracefully("null response from server!");
        >> }
        >>
        >> $method_response = $obj->$method($vhost, @arglist);
        >> if ( $method_response->fault ) {
        >> die_gracefully($method_response->faultstring);
        >> }
        >>
        >> return $method_response;
        >>}
        >>
        >>
        >>
        >
        >Because you are using autodispatch, you don't get the SOAP result
        >passed back, you get the value returned by your server method.
        >
        >You need to either not use autodispatch which from your sample
        >code looks the most clear approach. As the method names are passed
        >as parameters there doesn't seem any benefit in using autodispatch.
        >Or use the self() and call() methods to get the SOAP result and
        >fault, e.g.
        >
        >my $result = SOAP::Lite->self->call->result;
        >my $fault = SOAP::Lite->self->call->fault;
        ># etc
        >
        >Regards,
        >Duncan Cameron
        >
        >
        >
        >
        >
        >
        >
        >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/
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.