File: SOAPHTTP.pod

package info (click to toggle)
libxml-compile-soap-perl 3.28%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 4,407; makefile: 7
file content (312 lines) | stat: -rw-r--r-- 8,782 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
=encoding utf8

=head1 NAME

XML::Compile::Transport::SOAPHTTP - exchange XML-SOAP via HTTP

=head1 INHERITANCE

 XML::Compile::Transport::SOAPHTTP
   is a XML::Compile::Transport
   is a XML::Compile::SOAP::Extension

=head1 SYNOPSIS

 use XML::Compile::Transport::SOAPHTTP;

 my $http = XML::Compile::Transport::SOAPHTTP->new(@options);
 my $send = $http->compileClient(@options2);

 my $call = $wsdl->compileClient
   ( operation => 'some-port-name'
   , transport => $send
   );

 my ($xmlout, $trace) = $call->($xmlin);

 $wsdl->compileCalls(transport => $send);

=head1 DESCRIPTION

This module handles the exchange of (XML) messages, according to the
rules of SOAP (any version).  The module does not known how to parse
or compose XML, but only worries about the HTTP aspects.

Extends L<"DESCRIPTION" in XML::Compile::Transport|XML::Compile::Transport/"DESCRIPTION">.
 
=head1 METHODS

Extends L<"METHODS" in XML::Compile::Transport|XML::Compile::Transport/"METHODS">.
 
=head2 Constructors

Extends L<"Constructors" in XML::Compile::Transport|XML::Compile::Transport/"Constructors">.
 
=over 4

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<new>(%options)

Create a SOAP-over-HTTP handler, implemented as a wrapper around
LWP::UserAgent.

If you need to change UserAgent settings (for instance at runtime),
you can always directly access the internal C<LWP::UserAgent> object
via L<userAgent()|XML::Compile::Transport::SOAPHTTP/"Accessors">.

B<Warning:> The C<ssl_opts>, C<keep_alive> and C<timeout> options are
only used when an default internal C<LWP::UserAgent> is created; this
is only once in a program.  Later instantiations of this ::SOAPHTTP
will share that default agent, even though these passed parameters have
different parameters.  If that is not what you want, then pass your own
C<user_agent> object to the constructor to avoid the use of the default.

 -Option    --Defined in             --Default
  address     XML::Compile::Transport  'http://localhost'
  charset     XML::Compile::Transport  'UTF-8'
  keep_alive                           <true>
  ssl_opts                             <undef>
  timeout                              180
  user_agent                           <created when needed>

=over 2

=item address => URI|ARRAY-of-URI

=item charset => STRING

=item keep_alive => BOOLEAN

When connection can be re-used.

=item ssl_opts => HASH

[3.28] In case you need to use https, but are not interested in checking (or even
configuring) certificates, you may want to pass C<< verify_hostname => 0 >>.

=item timeout => SECONDS

The maximum time for a single connection before the client will close it.
The server may close it earlier.  Do not set the timeout too long, because
you want objects to be cleaned-up.

=item user_agent => LWP::UserAgent object

If you do not pass your own user agent, a default will be created for you.

=back

=back

=head2 WSDL11

Extends L<"WSDL11" in XML::Compile::Transport|XML::Compile::Transport/"WSDL11">.
 
=over 4

=item $obj-E<gt>B<wsdl11Init>($wsdl, $args)

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<wsdl11Init>($wsdl, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"WSDL11">

=back

=head2 SOAP11

Extends L<"SOAP11" in XML::Compile::Transport|XML::Compile::Transport/"SOAP11">.
 
=over 4

=item $obj-E<gt>B<soap11ClientWrapper>($operation, $call, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP11">

=item $obj-E<gt>B<soap11HandlerWrapper>($operation, $callback, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP11">

=item $obj-E<gt>B<soap11OperationInit>($operation, $args)

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<soap11OperationInit>($operation, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP11">

=back

=head2 SOAP12

Extends L<"SOAP12" in XML::Compile::Transport|XML::Compile::Transport/"SOAP12">.
 
=over 4

=item $obj-E<gt>B<soap12ClientWrapper>($operation, $call, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP12">

=item $obj-E<gt>B<soap12HandlerWrapper>($operation, $callback, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP12">

=item $obj-E<gt>B<soap12OperationInit>($operation, $args)

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<soap12OperationInit>($operation, $args)

Inherited, see L<XML::Compile::SOAP::Extension/"SOAP12">

=back

=head2 Accessors

Extends L<"Accessors" in XML::Compile::Transport|XML::Compile::Transport/"Accessors">.
 
=over 4

=item $obj-E<gt>B<address>()

Inherited, see L<XML::Compile::Transport/"Accessors">

=item $obj-E<gt>B<addresses>()

Inherited, see L<XML::Compile::Transport/"Accessors">

=item $obj-E<gt>B<charset>()

Inherited, see L<XML::Compile::Transport/"Accessors">

=item $obj-E<gt>B<defaultUserAgent>()

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<defaultUserAgent>()

[3.07] Returns the used LWP::UserAgent, available after the compilation
of the SOAP call(s).

=item $obj-E<gt>B<userAgent>( [$agent|<undef, %options>] )

Returns the User Agent which will be used.  You may change the
configuration of the $agent (the returned LWP::UserAgent object)
or provide one yourself.  See also L<new(user_agent)|XML::Compile::Transport::SOAPHTTP/"METHODS">.

Changes to the agent configuration can be made before or after the
compilation, or even inbetween SOAP calls.

=back

=head2 Handlers

Extends L<"Handlers" in XML::Compile::Transport|XML::Compile::Transport/"Handlers">.
 
=over 4

=item $obj-E<gt>B<compileClient>(%options)

Compile an HTTP client handler.  Returned is a subroutine which is called
with a text represenation of the XML request, or an XML::LibXML tree.
In SCALAR context, an XML::LibXML parsed tree of the answer message
is returned.  In LIST context, that answer is followed by a HASH which
contains trace information.

 -Option    --Defined in             --Default
  action                               ''
  header                               <created>
  hook        XML::Compile::Transport  <undef>
  kind                                 'request-response'
  method                               'POST'
  mime_type                            <depends on soap version>
  mpost_id                             42
  soap                                 'SOAP11'
  xml_format  XML::Compile::Transport  0

=over 2

=item action => URI

=item header => HTTP::Headers object

Versions of L<XML::Compile|XML::Compile>, L<XML::Compile::SOAP|XML::Compile::SOAP>, and LWP will be
added to simplify bug reports.

=item hook => CODE

=item kind => DIRECTION

What kind of interactie, based on the four types defined by WSDL(1):
C<notification-operation> (server initiated, no answer required),
C<one-way> (client initiated, no answer required), C<request-response>
(client initiated, the usual in both directions), C<solicit-response> (server
initiated "challenge").

=item method => 'POST'|'M-POST'

With C<POST>, you get the standard HTTP exchange.  The C<M-POST> is
implements the (Microsoft) HTTP Extension Framework.  Some servers
accept both, other require a specific request.

=item mime_type => STRING

=item mpost_id => INTEGER

With method C<M-POST>, the header extension fields require (any) number
to be grouped.

=item soap => 'SOAP11'|'SOAP12'|OBJECT

=item xml_format => 0|1|2

=back

example: create a client

 my $trans = XML::Compile::Transport::SOAPHTTP->new
   ( address => 'http://www.stockquoteserver.com/StockQuote'
   );

 my $call = $trans->compileClient
   ( action  => 'http://example.com/GetLastTradePrice'
   );

 # $request and $answer are XML::LibXML trees!
 # see XML::Compile::SOAP::Client::compileClient() for wrapper which
 # converts from and to Perl data structures.

 my ($answer, $trace) = $call->($request);
 my $answer = $call->($request); # drop $trace info immediately

=item $obj-E<gt>B<headerAddVersions>($header)

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<headerAddVersions>($header)

Adds some lines about module versions, which may help debugging
or error reports.  This is called when a new client or server
is being created.

=back

=head1 DETAILS

Extends L<"DETAILS" in XML::Compile::Transport|XML::Compile::Transport/"DETAILS">.
 
=head1 Helpers

Extends L<"Helpers" in XML::Compile::Transport|XML::Compile::Transport/"Helpers">.
 
=over 4

=item XML::Compile::Transport::SOAPHTTP-E<gt>B<register>($uri)

Inherited, see L<XML::Compile::Transport/"Helpers">

=back

=head1 SEE ALSO

This module is part of XML-Compile-SOAP distribution version 3.28,
built on August 01, 2022. Website: F<http://perl.overmeer.net/CPAN/>

=head1 LICENSE

Copyrights 2007-2022 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>