NAME
Catalyst::Controller::SOAP - Catalyst SOAP Controller
SYNOPSIS
package MyApp::Controller::Example;
use base 'Catalyst::Controller::SOAP';
# available in "/example" as operation "echo"
# parsing the arguments as soap-encoded.
sub echo : SOAP('RPCEncoded') {
my ( $self, $c, @args ) = @_;
}
# available in "/example" as operation "ping". The arguments are
# treated as a literal document and passed to the method as a
# XML::LibXML object
sub ping : SOAP('RPCLiteral') {
my ( $self, $c, $xml) = @_;
my $name = $xml->findValue('some xpath expression');
}
# avaiable as "/example/world" in document context. The entire body
# is delivered to the method as a XML::LibXML object.
sub world : SOAP('DocumentLiteral') {
my ($self, $c, $doc) = @_;
}
# this is the endpoint from where the RPC operations will be
# dispatched. This code won't be executed at all.
sub index : SOAP('RPCEndpoint') {}
ABSTACT
Implements SOAP serving support in Catalyst.
DESCRIPTION
SOAP Controller for Catalyst which we tried to make compatible with the
way Catalyst works with URLS.It is important to notice that this
controller declares by default an index operation which will dispatch
the RPC operations under this class.
ATTRIBUTES
This class implements the SOAP attribute wich is used to do the mapping
of that operation to the apropriate action class. The name of the class
used is formed as Catalyst::Action::SOAP::$value, unless the parameter
of the attribute starts with a '+', which implies complete namespace.
The implementation of SOAP Action classes helps delivering specific SOAP
scenarios, like HTTP GET, RPC Encoded, RPC Literal or Document Literal,
or even Document RDF or just about any required combination.
See Catalyst::Action::SOAP::DocumentLiteral for an example.
ACCESSORS
Once you tagged one of the methods, you'll have an $c->stash->{soap}
accessor which will return an "Catalyst::Controller::SOAP::Helper"
object. It's important to notice that this is achieved by the fact that
all the SOAP Action classes are subclasses of Catalyst::Action::SOAP,
which implements most of that.
You can query this object as follows:
$c->stash->{soap}->envelope()
The original SOAP envelope as string.
$c->stash->{soap}->parsed_envelope()
The parsed envelope as an XML::LibXML object.
$c->stash->{soap}->arguments()
The arguments of a RPC call.
$c->stash->{soap}->fault({code => $code,reason => $reason, detail =>
$detail])
Allows you to set fault code and message. Optionally, you may define
the code itself as an arrayref where the first item will be this
code and the second will be the subcode, which recursively may be
another arrayref.
$c->stash->{soap}->encoded_return(\@data)
This method will prepare the return value to be a soap encoded data.
$c->stash->{soap}->literal_return($xml_node)
This method will prepare the return value to be a literal XML
document, in this case, you can pass just the node that will be the
root in the return message.
$c->stash->{soap}->literal_string_return($xml_text)
In this case, the argument is used literally inside the message. It
is supposed to already contain all namespace definitions in it.
$c->stash->{soap}->string_return($non_xml_text)
In this case, the given text is encoded as CDATA inside the SOAP
message.
TODO
At this moment, this is a very early release. So almost everything is
still to be done. The only thing done right now is getting the body from
the message and dispatching the correct method.
SEE ALSO
Catalyst::Action::SOAP, XML::LibXML,
Catalyst::Action::SOAP::DocumentLiteral,
Catalyst::Action::SOAP::RPCEncoded, Catalyst::Action::SOAP::HTTPGet
AUTHORS
Daniel Ruoso "daniel@ruoso.com"
Drew Taylor "drew@drewtaylor.com"
BUG REPORTS
Please submit all bugs regarding "Catalyst::Controller::SOAP" to
"bug-catalyst-controller-soap@rt.cpan.org"
LICENSE
This library is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.