SOAP: The Power Of Simplicity 
O'Reilly P2P Conference 2001
<<< 23/52 >>>
Copyright (C) 2001 Paul Kulchenko, Tony Hong

SOAP::Lite, Basic concepts: Fault handling

  
  use SOAP::Lite;
  my $result = SOAP::Lite
    -> uri('http://www.soaplite.com/Temperatures')
    -> proxy('http://services.soaplite.com/temper.cgi')
    -> c2f(37.5);
  if ($result->fault) {
    print join ', ', $result->faultcode, $result->faultstring;
  } else {
    print $result->result;
  }

You can access faultcode(), faultstring() and faultdetail() methods which will give you a description of an error.

Other toolkits may react differently if a fault is returned. For example, most Java client toolkits will throw an exception based on the fault.

You can customize this behavior with SOAP::Lite using on_fault handler.