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

SOAP::Lite, Advanced concepts: WSDL, Access to fault information

One notable difference with RPC call using WSDL is that it returns result without giving you access to envelope. In some cases you may need this access (for example, to get a fault information).

  use SOAP::Lite;
  my $service = SOAP::Lite                             
    -> service('');
  my $result = $service->getPrice('0596000278');
  print $service->call->faultstring if $service->call->fault;

If you use 'import' interface, then SOAP::Lite->self can help to get this information:

  use SOAP::Lite
    service => '';
  my $result = getPrice('0596000278');
  my $envelope = SOAP::Lite->self->call;
  print $envelope->faultstring if $envelope->fault;