1SOAP::Fault(3) User Contributed Perl Documentation SOAP::Fault(3)
2
3
4
6 SOAP::Fault - encapsulates SOAP faults prior to their serialization or
7 after their deserialization
8
10 This class encapsulates SOAP faults prior to their serialization or
11 after their deserialization. The methods available are a constructor
12 and four accessors. Each accessor creates an object on demand, just as
13 the other classes do, when called as a static method. Like other
14 accessors in the SOAP::Lite package, they return the object itself when
15 setting the attribute.
16
18 To generate a SOAP Fault simply issue a Perl die command on the server
19 side as you might normally. The SOAP processor will intercept the die
20 command and return a SOAP Fault, using the string passed to the die
21 command as the faultstring, to the client making the call. If you
22 require having more control over the SOAP Fault returned to the client,
23 then simply pass a SOAP::Fault object to the die command and the SOAP
24 processor will behave accordingly. For example:
25
26 die SOAP::Fault->faultcode('Server.Custom') # will be qualified
27 ->faultstring('Died in server method')
28 ->faultdetail(bless {code => 1} => 'BadError')
29 ->faultactor('http://www.soaplite.com/custom');
30
32 new(optional data)
33 $fault = SOAP::Fault->new(faultcode => 'Server');
34
35 Explicitly creates a new SOAP::Fault object. Any of the four
36 attributes represented next by accessor methods may be passed in
37 the argument list with values immediately following their attribute
38 name.
39
40 faultcode(optional value)
41 $fault->faultcode('MethodUnknown');
42
43 Returns the current fault code or sets it if a value is given.
44
45 faultstring(optional value)
46 $fault->faultstring("There is no $method here");
47
48 Returns or sets the fault string.
49
50 faultactor(optional value)
51 $fault->faultcode($header->actor);
52
53 Returns or sets the fault-actor element. Note that the actor isn't
54 always required in a SOAP fault.
55
56 faultdetail(optional value)
57 $fault->faultcode(bless { proxy => $ip }, 'Err');
58
59 Returns or sets the fault's detail element. Like the actor, this
60 isn't always a required element. Note that fault detail content in
61 a message is represented as tag blocks. Thus, the values passed to
62 this accessor when setting the value are either SOAP::Data objects,
63 or more general blessed hash references.
64
65 In addition to these methods, the SOAP::Fault package also provides
66 detail as an alias for faultdetail. The former is the actual name of
67 the element with SOAP faults, but the latter name is less ambiguous
68 when regarded with the rest of the SOAP::Lite package. Objects of this
69 class also have a special stringification enabled. If an object is
70 printed or otherwise stringified, the value produced is faultcode:
71 faultstring, with the attribute values of the object.
72
74 SOAP::Data, SOAP::Header, SOAP::SOM
75
77 Special thanks to O'Reilly publishing which has graciously allowed
78 SOAP::Lite to republish and redistribute large excerpts from
79 Programming Web Services with Perl, mainly the SOAP::Lite reference
80 found in Appendix B.
81
83 Copyright (C) 2000-2004 Paul Kulchenko. All rights reserved.
84
85 This library is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself.
87
89 Paul Kulchenko (paulclinger@yahoo.com)
90
91 Randy J. Ray (rjray@blackperl.com)
92
93 Byrne Reese (byrne@majordojo.com)
94
95
96
97perl v5.36.0 2023-01-20 SOAP::Fault(3)