perldoc > SOAP::Fault

πŸ“– NAME

SOAP::Fault β€” encapsulates SOAP faults prior to their serialization or after their deserialization

πŸš€ Quick Reference

Use Case Command Description
🎯 Create a new fault object SOAP::Fault->new(faultcode => 'Server') Explicitly create a SOAP::Fault object with optional attributes.
🏷️ Set fault code $fault->faultcode('MethodUnknown') Set or retrieve the fault code (e.g., Server.Custom).
πŸ“ Set fault string $fault->faultstring("There is no $method here") Set or retrieve the human‑readable fault description.
🎭 Set fault actor $fault->faultactor($header->actor) Set or retrieve the URI of the fault originator (optional).
πŸ” Set fault detail $fault->faultdetail(bless { proxy => $ip }, 'Err') Set or retrieve the detail element (optional).
πŸ’₯ Throw a fault via die die SOAP::Fault->faultcode('Server')->faultstring('Error') Generate a SOAP Fault on the server side by passing a SOAP::Fault object to die.

πŸ“– DESCRIPTION

This class encapsulates SOAP faults prior to their serialization or after their deserialization. The methods available are a constructor and four accessors. Each accessor creates an object on demand, just as the other classes do, when called as a static method. Like other accessors in the SOAP::Lite package, they return the object itself when setting the attribute.

πŸ”„ GENERATING A SOAP FAULT

To generate a SOAP Fault simply issue a Perl die command on the server side as you might normally. The SOAP processor will intercept the die command and return a SOAP Fault, using the string passed to the die command as the faultstring, to the client making the call. If you require having more control over the SOAP Fault returned to the client, then simply pass a SOAP::Fault object to the die command and the SOAP processor will behave accordingly. For example:

die SOAP::Fault->faultcode('Server.Custom') # will be qualified
               ->faultstring('Died in server method')
               ->faultdetail(bless {code => 1} => 'BadError')
               ->faultactor('http://www.soaplite.com/custom');

πŸ› οΈ METHODS

πŸ†• new(optional data)

$fault = SOAP::Fault->new(faultcode => 'Server');

Explicitly creates a new SOAP::Fault object. Any of the four attributes represented next by accessor methods may be passed in the argument list with values immediately following their attribute name.

🏷️ faultcode(optional value)

$fault->faultcode('MethodUnknown');

Returns the current fault code or sets it if a value is given.

πŸ“ faultstring(optional value)

$fault->faultstring("There is no $method here");

Returns or sets the fault string.

🎭 faultactor(optional value)

$fault->faultactor($header->actor);

Returns or sets the fault-actor element. Note that the actor isn't always required in a SOAP fault.

πŸ” faultdetail(optional value)

$fault->faultdetail(bless { proxy => $ip }, 'Err');

Returns or sets the fault's detail element. Like the actor, this isn't always a required element. Note that fault detail content in a message is represented as tag blocks. Thus, the values passed to this accessor when setting the value are either SOAP::Data objects, or more general blessed hash references.

In addition to these methods, the SOAP::Fault package also provides detail as an alias for faultdetail. The former is the actual name of the element with SOAP faults, but the latter name is less ambiguous when regarded with the rest of the SOAP::Lite package. Objects of this class also have a special stringification enabled. If an object is printed or otherwise stringified, the value produced is faultcode: faultstring, with the attribute values of the object.

πŸ“š SEE ALSO

πŸ™ ACKNOWLEDGEMENTS

Special thanks to O'Reilly publishing which has graciously allowed SOAP::Lite to republish and redistribute large excerpts from Programming Web Services with Perl, mainly the SOAP::Lite reference found in Appendix B.

©️ COPYRIGHT

Copyright (C) 2000-2004 Paul Kulchenko. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

πŸ‘€ AUTHORS

SOAP::Fault
πŸ“– NAME πŸš€ Quick Reference πŸ“– DESCRIPTION πŸ”„ GENERATING A SOAP FAULT πŸ› οΈ METHODS
πŸ†• new(optional data) 🏷️ faultcode(optional value) πŸ“ faultstring(optional value) 🎭 faultactor(optional value) πŸ” faultdetail(optional value)
πŸ“š SEE ALSO πŸ™ ACKNOWLEDGEMENTS ©️ COPYRIGHT πŸ‘€ AUTHORS

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-30 14:16 @216.73.217.152
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^