NAME
XML::Compile::Transport::SOAPHTTP_MojoUA - exchange XML via Mojo::UserAgent
INHERITANCE
XML::Compile::Transport::SOAPHTTP_MojoUA
is a XML::Compile::Transport
is a XML::Compile::SOAP::Extension
SYNOPSIS
# See examples in distribution
use XML::Compile::Transport::SOAPHTTP_MojoUA;
my $http = XML::Compile::Transport::SOAPHTTP_MojoUA->new(
, ua_start_callback => \&code,
, mojo_ua => $t->ua,
);
my $send = $http->compileClient(@options2);
my $call = $wsdl->compileClient
( operation => 'some-port-name'
, transport => $send
, async => 1 # required!
);
sub handler
{ my ($xmlout, $trace) = @_;
# so something
};
# The _callback relates to async
$call->($xmlin, _callback => \&handler);
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.
Contrary to XML::Compile::Transport::SOAPHTTP, this implementation can be used in a non-blocking Mojolicious context, via Mojo::UserAgent.
Just use
ing this module will make your WSDL object use it as transport handler for async connections (i.e., when the async
param show above is set to a true value).
Be aware that, if you explicitly pass in an object for the transport param as shown above you take full responsibility for the connection. That means that, e.g, you have to set server address yourself: it is no longer automatically taken from the WSDL and passed to the internally created (implicit / hidden) transporter.
This module was contributed by Heiko Jansen hjansen@cpan.org
Extends "DESCRIPTION" in XML::Compile::Transport.
METHODS
Extends "METHODS" in XML::Compile::Transport.
Constructors
Extends "Constructors" in XML::Compile::Transport.
- XML::Compile::Transport::SOAPHTTP_MojoUA->new(%options)
-
-Option --Defined in --Default address XML::Compile::Transport 'http://localhost' charset XML::Compile::Transport 'UTF-8' mojo_ua undef ua_start_callback undef
- address => URI|ARRAY-of-URI
- charset => STRING
- mojo_ua => Mojo::UserAgent-object
-
With this option you can pass in the mojo user agent instead of having the module instantiate a new one. This is especially important when using this module from within Test::Mojo to communicate with a mock soap server, you should take care of passing the user agent object of the mojo app under test, otherwise you tests will probably derail with an app object that has gone out of scope unexpectedly.
my $t = Test::Mojo->new('Mojolicious'); my $httpUa = XML::Compile::Transport::SOAPHTTP_MojoUA->new( mojo_ua => $t->ua );
Note that when you are using the
ua_start_callback
option in connection with an shared ua instance, this might cause problem for later uses of this ua as the callback: it will get called at every start of the ua, even outside of the SOAP use. - ua_start_callback => CODE
-
A subroutine ref passed to the
start
event of the user agent object.
WSDL11
Extends "WSDL11" in XML::Compile::Transport.
- $obj->wsdl11Init($wsdl, $args)
- XML::Compile::Transport::SOAPHTTP_MojoUA->wsdl11Init($wsdl, $args)
-
Inherited, see "WSDL11" in XML::Compile::SOAP::Extension
SOAP11
Extends "SOAP11" in XML::Compile::Transport.
- $obj->soap11ClientWrapper($operation, $call, $args)
-
Inherited, see "SOAP11" in XML::Compile::SOAP::Extension
- $obj->soap11HandlerWrapper($operation, $callback, $args)
-
Inherited, see "SOAP11" in XML::Compile::SOAP::Extension
- $obj->soap11OperationInit($operation, $args)
- XML::Compile::Transport::SOAPHTTP_MojoUA->soap11OperationInit($operation, $args)
-
Inherited, see "SOAP11" in XML::Compile::SOAP::Extension
SOAP12
Extends "SOAP12" in XML::Compile::Transport.
- $obj->soap12ClientWrapper($operation, $call, $args)
-
Inherited, see "SOAP12" in XML::Compile::SOAP::Extension
- $obj->soap12HandlerWrapper($operation, $callback, $args)
-
Inherited, see "SOAP12" in XML::Compile::SOAP::Extension
- $obj->soap12OperationInit($operation, $args)
- XML::Compile::Transport::SOAPHTTP_MojoUA->soap12OperationInit($operation, $args)
-
Inherited, see "SOAP12" in XML::Compile::SOAP::Extension
Accessors
Extends "Accessors" in XML::Compile::Transport.
- $obj->address()
-
Inherited, see "Accessors" in XML::Compile::Transport
- $obj->addresses()
-
Inherited, see "Accessors" in XML::Compile::Transport
- $obj->charset()
-
Inherited, see "Accessors" in XML::Compile::Transport
- $obj->uaStartCallback()
-
Read-only accessing the
start
event callback.
Handlers
Extends "Handlers" in XML::Compile::Transport.
- $obj->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
- action => URI
- header => HTTP::Headers object
-
Versions of XML::Compile, XML::Compile::SOAP, and LWP will be added to simplify bug reports.
- hook => CODE
- kind => DIRECTION
-
What kind of interactie, based on the four types defined by WSDL(1):
notification-operation
(server initiated, no answer required),one-way
(client initiated, no answer required),request-response
(client initiated, the usual in both directions),solicit-response
(server initiated "challenge"). - method => 'POST'|'M-POST'
-
With
POST
, you get the standard HTTP exchange. TheM-POST
is implements the (Microsoft) HTTP Extension Framework. Some servers accept both, other require a specific request. - mime_type => STRING
- mpost_id => INTEGER
-
With method
M-POST
, the header extension fields require (any) number to be grouped. - soap => 'SOAP11'|'SOAP12'|OBJECT
- xml_format => 0|1|2
- $obj->headerAddVersions($header)
- XML::Compile::Transport::SOAPHTTP_MojoUA->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.
DETAILS
Extends "DETAILS" in XML::Compile::Transport.
Helpers
Extends "Helpers" in XML::Compile::Transport.
- XML::Compile::Transport::SOAPHTTP_MojoUA->register($uri)
-
Inherited, see "Helpers" in XML::Compile::Transport
SEE ALSO
This module is part of XML-Compile-SOAP-Mojolicious distribution version 0.06, built on January 06, 2020. Website: http://perl.overmeer.net/xml-compile/
LICENSE
Copyrights 2016-2020 by [Mark Overmeer <markov@overmeer.net>]. 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 http://dev.perl.org/licenses/