XML::Compile::Transport::SOAPHTTP_MojoUA - exchange XML via Mojo::UserAgent
XML::Compile::Transport::SOAPHTTP_MojoUA is a XML::Compile::Transport is a XML::Compile::SOAP::Extension
# 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);
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 useing 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).
use
async
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.
Extends "METHODS" in XML::Compile::Transport.
Extends "Constructors" in XML::Compile::Transport.
-Option --Defined in --Default address XML::Compile::Transport 'http://localhost' charset XML::Compile::Transport 'UTF-8' mojo_ua undef ua_start_callback undef
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
A subroutine ref passed to the start event of the user agent object.
start
Extends "WSDL11" in XML::Compile::Transport.
Inherited, see "WSDL11" in XML::Compile::SOAP::Extension
Extends "SOAP11" in XML::Compile::Transport.
Inherited, see "SOAP11" in XML::Compile::SOAP::Extension
Extends "SOAP12" in XML::Compile::Transport.
Inherited, see "SOAP12" in XML::Compile::SOAP::Extension
Extends "Accessors" in XML::Compile::Transport.
Inherited, see "Accessors" in XML::Compile::Transport
Read-only accessing the start event callback.
Extends "Handlers" in XML::Compile::Transport.
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
Versions of XML::Compile, XML::Compile::SOAP, and LWP will be added to simplify bug reports.
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").
notification-operation
one-way
request-response
solicit-response
With POST, you get the standard HTTP exchange. The M-POST is implements the (Microsoft) HTTP Extension Framework. Some servers accept both, other require a specific request.
POST
M-POST
With method M-POST, the header extension fields require (any) number to be grouped.
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.
Extends "DETAILS" in XML::Compile::Transport.
Extends "Helpers" in XML::Compile::Transport.
Inherited, see "Helpers" in XML::Compile::Transport
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/
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/
To install XML::Compile::SOAP::Mojolicious, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Compile::SOAP::Mojolicious
CPAN shell
perl -MCPAN -e shell install XML::Compile::SOAP::Mojolicious
For more information on module installation, please visit the detailed CPAN module installation guide.