XML::CompileX::Transport::SOAPXMPP - Send SOAP messages through XMPP
use XML::CompileX::Transport::SOAPXMPP; my $trans = XML::CompileX::Transport::SOAPXMPP->new() $send = $trans->compileClient(); my $call = $wsdl->compileClient( operation => 'foo', transport => $send); # later on... $trans->connection($net_xmpp2_connection_object); $trans->address('email@example.com/resource') $call->(...);
This module serves as the transport layer for the XML::Compile::SOAP suite. It provides XMPP acccess to srevices, but it doesn't deal with the parsing of the message or of the wsdl in any way, it is simply used to send and receive XML data.
This method creates a new transport object. Unlike the HTTP transport this object does not represent a connection by itself. This object represents a connection manager, that will allow you to set the Net::XMPP2 object to use when doing the actual requests.
This is a important feature because XMPP implies a context of who in sending the message, unlike HTTP, and in most cases, you might want to reuse the result from Compile Client to do the same call using different sender identifications.
OPTIONS can be (see below for details):
Allows you to set the initial connection to be used. It's not required if you set it later, but there must be a set connection before a message can be sent.
This method sets the connection to be used by the calls that were compiled with this transport manager. This is mostly like setting a global variable, but it is limited to the scope of the clients compiled with this transport.
By default, request/response messages will be sent using 'iq' stanzas and request-only messages will be sent using 'message'. You can force one of both, or set it to the default behaviour.
It is important to realise that in order to maintain a coherent interface with XML::Compile::SOAP, 'iq' messages will, by default, block the current execution until the iq reply is received.
This method can be used to override the default behaviour of holding the execution until the iq reply is received. It's important to realise that this is not really blocking the process, but simply getting into the main loop while the iq reply is received. This is done using AnyEvent->condvar. Please take a look at AnyEvent documentation.
Id of the last message sent.
Id of the last iq sent.
Returns a hashref of all currently stored iq replies.
When an iq reply is received, it is stored in this object using the id as a key. This method allows you to fetch that response. It will return undef if there is no reply for that id, which can mean that either the reply didn't arrive or it was already consumed.
The return of this method is the Net::XMPP2::Node object of the iq reply.
Net::XMPP2 is completely asynchronous. This means that even when you ask it to send a message, the message might not be sent yet, because if the write would block, Net::XMPP2 will return immediatly and wait for a next event loop iteraction to continue the send process. This might not be desirable when dealing with SOAP services.
On the other hand, Net::XMPP2 also provides an option for waiting until the buffer is empty before returning from send_message and send_iq. Please take a look at Net::XMPP2::Connection documentation for details on that.
It's important to realise that XMPP is, by definition, an async protocol. When using request-only messages, the only way to know that something went wrong is to wait for errors. If the error is not transport-related, it won't even be reported as an error, but as a normal message with a fault in the body.
This is the basic reason for mapping request/response messages as iq stanzas.
This module, at this moment, won't expect for fault messages. If you're using request-only, you should register callbacks in the xmpp connection to receive them. You can introspect into the WSDL Operation to compile and parse the fault messages.
Copyright 2008 by Daniel Ruoso. 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://www.perl.com/perl/misc/Artistic.html