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

Re: [soaplite] Throw fault from XMLRPC::Lite server?

Expand Messages
  • Paul Kulchenko
    Hi Larry, ... you need to use die instead: die Error! ; If you need to have more granular access to fault information, then you may use SOAP::Fault class
    Message 1 of 2 , Nov 13, 2002
    • 0 Attachment
      Hi Larry,

      > return { fault => {
      > faultCode => 1001,
      > faultString => "Error!",
      > }
      > };

      you need to use 'die' instead:

      die "Error!";

      If you need to have more granular access to fault information, then
      you may use SOAP::Fault class (unfortunately there is no
      XMLRPC::Fault class; it's on todo list). You may define XMLRPC::Fault
      in your code as

      BEGIN { package XMLRPC::Fault; @XMLRPC::Fault::ISA = 'SOAP::Fault' }

      and then just use

      die XMLRPC::Fault->faultcode(1001)->faultstring('Error!');

      Best wishes, Paul.

      --- Larry <larryl@...> wrote:
      > I've got a simple XMLRPC server set up using XMLRPC::Lite and
      > mod_perl. I can't figure out how to throw a fault from my methods,
      >
      > it keeps coming back to the client looking like a normal response.
      >
      > The methods themselves are working fine. I'm sure it's something
      > basic I am missing but I haven't tracked it down. My httpd.conf
      > looks like:
      > _________________________________________
      >
      > PerlModule My::XMLRPC
      > <Location /xmlrpc>
      > SetHandler perl-script
      > PerlHandler Apache::XMLRPC::Lite
      > PerlSetVar dispatch_to "My::XMLRPC"
      > </Location>
      > _________________________________________
      >
      > and in My/XMLRPC.pm I want to do something like:
      > _________________________________________
      >
      > package My::XMLRPC;
      >
      > sub hello
      > {
      > if ( things_are_good() {
      > return "hello";
      > else {
      > return { fault => {
      > faultCode => 1001,
      > faultString => "Error!",
      > }
      > };
      > }
      > }
      >
      > 1;
      > _________________________________________
      >
      > Any help appreciated!
      >
      > Thanks,
      > Larry Leszczynski
      >
      >
      >
      > ------------------------ 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!?
      U2 on LAUNCH - Exclusive greatest hits videos
      http://launch.yahoo.com/u2
    Your message has been successfully submitted and would be delivered to recipients shortly.