1SOAP::WSDL::Client(3) User Contributed Perl DocumentationSOAP::WSDL::Client(3)
2
3
4

NAME

6       SOAP::WSDL::Client - SOAP::WSDL's SOAP Client
7

SYNOPSIS

9        use SOAP::WSDL::Client;
10        my $soap = SOAP::WSDL::Client->new({
11            proxy => 'http://www.example.org/webservice/test'
12        });
13        $soap->call( \%method, $body, $header);
14

METHODS

16   call
17        $soap->call( \%method, \@parts );
18
19       %method is a hash with the following keys:
20
21        Name           Description
22        ----------------------------------------------------
23        operation      operation name
24        soap_action    SOAPAction HTTP header to use
25        style          Operation style. One of (document|rpc)
26        use            SOAP body encoding. One of (literal|encoded)
27
28       The style and use keys have no influence yet.
29
30       @parts is a list containing the elements of the message parts.
31
32       For backward compatibility, call may also be called as below:
33
34        $soap->call( $method, \@parts );
35
36       In this case, $method is the SOAP operation name, and the SOAPAction
37       header is guessed from the first part's namespace and the operation
38       name (which is mostly correct, but may fail). Operation style and body
39       encoding are assumed to be document/literal
40
41   Configuration methods
42       outputxml
43
44        $soap->outputxml(1);
45
46       When set, call() returns the raw XML of the SOAP Envelope.
47
48       set_content_type
49
50        $soap->set_content_type('application/xml; charset: utf8');
51
52       Sets the content type and character encoding.
53
54       You probably should not use a character encoding different from utf8:
55       SOAP::WSDL::Client will not convert the request into a different
56       encoding (yet).
57
58       To leave out the encoding, just set the content type without appending
59       charset like this:
60
61         $soap->set_content_type('text/xml');
62
63       Default:
64
65        text/xml; charset: utf8
66
67       set_prefix
68
69        $soap->set_prefix('ns2');
70
71       If set, alters the serialization of the request XML such that the
72       supplied value is used as a namespace prefix for SOAP method calls. By
73       way of example, the default XML serialization returns something like
74       this:
75
76           <?xml version="1.0"?>
77           <SOAP-ENV:Envelope
78               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
79               xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
80             <SOAP-ENV:Body>
81               <getElementId xmlns="http://services.exmaple.org/">
82                 <elementId>12345</elementId>
83               </getElementId>
84             </SOAP-ENV:Body>
85           </SOAP-ENV:Envelope>
86
87       If the sample set_prefix() call above is used prior to calling your
88       SOAP method, the XML serialization returns this instead:
89
90           <?xml version="1.0"?>
91           <SOAP-ENV:Envelope
92               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
93               xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
94               xmlns:ns2="http://services.example.org/">
95             <SOAP-ENV:Body>
96               <ns2:getElementId>
97                 <elementId>12345</elementId>
98               </ns2:getElementId>
99             </SOAP-ENV:Body>
100           </SOAP-ENV:Envelope>
101
102       This is useful in cases where, for instance, one is communicating with
103       a JAX <https://jax-ws.dev.java.net/> webservice, which tends to
104       understand the latter but not the former. Note that this implementation
105       is currently limited to a single additional namespace; if you require
106       multiple custom namespaces, you should probably look into creating your
107       own serializer.
108
109   Features different from SOAP::Lite
110       SOAP::WSDL does not aim to be a complete replacement for SOAP::Lite -
111       the SOAP::Lite module has its strengths and weaknesses and SOAP::WSDL
112       is designed as a cure for the weakness of little WSDL support - nothing
113       more, nothing less.
114
115       Nonetheless SOAP::WSDL mimics part of SOAP::Lite's API and behaviour,
116       so SOAP::Lite users can switch without looking up every method call in
117       the documentation.
118
119       A few things are quite different from SOAP::Lite, though:
120
121       SOAP request data
122
123       SOAP request data may either be given as message object, or as a hash
124       ref (in which case it will automatically be encoded into a message
125       object).
126
127       Return values
128
129       The result from call() is not a SOAP::SOM object, but a message object.
130
131       Message objects' classes may be generated from WSDL definitions
132       automatically - see SOAP::WSDL::Generator::Typelib on how to generate
133       your own WSDL based message class library.
134
135       Fault handling
136
137       SOAP::WSDL::Client returns a fault object on errors, even on transport
138       layer errors.
139
140       The fault object is a SOAP1.1 fault object of the following
141       "SOAP::WSDL::SOAP::Typelib::Fault11".
142
143       SOAP::WSDL::SOAP::Typelib::Fault11 objects are false in boolean
144       context, so you can just do something like:
145
146        my $result = $soap->call($method, $data);
147
148        if ($result) {
149           # handle result
150        }
151        else {
152           die $result->faultstring();
153        }
154
155       outputxml
156
157       SOAP::Lite returns only the content of the SOAP body when outputxml is
158       set to true. SOAP::WSDL::Client returns the complete XML response.
159
160       Auto-Dispatching
161
162       SOAP::WSDL::Client does not support auto-dispatching.
163
164       This is on purpose: You may easily create interface classes by using
165       SOAP::WSDL::Client and implementing something like
166
167        sub mySoapMethod {
168            my $self = shift;
169            $soap_wsdl_client->call( mySoapMethod, @_);
170        }
171
172       You may even do this in a class factory - see wsdl2perl.pl for creating
173       such interfaces.
174

TROUBLESHOOTING

176   Accessing protected web services
177       Accessing protected web services is very specific for the transport
178       backend used.
179
180       In general, you may pass additional arguments to the set_proxy method
181       (or a list ref of the web service address and any additional arguments
182       to the new method's proxy argument).
183
184       Refer to the appropriate transport module for documentation.
185
187       Copyright 2004-2007 Martin Kutter.
188
189       This file is part of SOAP-WSDL. You may distribute/modify it under the
190       same terms as perl itself
191

AUTHOR

193       Martin Kutter <martin.kutter fen-net.de>
194

REPOSITORY INFORMATION

196        $Rev: 851 $
197        $LastChangedBy: kutterma $
198        $Id: Client.pm 851 2009-05-15 22:45:18Z kutterma $
199        $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $
200
201
202
203perl v5.30.0                      2019-07-26             SOAP::WSDL::Client(3)
Impressum