From: Jason S. <jas...@gm...> - 2008-09-18 01:40:10
|
Hey All, So I've been doing a lot of digging through the codebase understanding how doc/lit could be used at the moment, and I find that the ease of use that S::L provides for rpc/enc is not matched in it's doc/lit support. I don't think it would take very much effort to enable simple support for doc/lit on both the client and the server - but very likely there would be issues with compatibility with Java and .NET implementations that would have to be worked out. For me the major difference is that a client wanting to use a doc/lit service wants to simply attach a pre-produced XML payload to the soap message - and the server wants to retrieve that message - WITHOUT ANY INTERFERENCE FROM SOAP::LIT. so we have: -- begin of client.pl 8< -- use SOAP::Lite; my $soap = SOAP::Lite->new( proxy => 'http://localhost:80/helloworld.pl'); my $xml =<<XML; <sayHello xmlns="urn:HelloWorld"> <name>Kutter</name> <givenName>Martin</givenName> </sayHello> <sayHelloResponse> <sayHelloResult>Hello Martin Kutter!</sayHelloResult> </sayHelloResponse> XML $soap->on_action( sub { "urn:HelloWorld#sayHello" }); $soap->autotype(0); $soap->default_ns('urn:HelloWorld'); my $som = $soap->document($xml)->call("sayHello"); die $som->fault->{ faultstring } if ($som->fault); print $som->result, "\n"; -- end of client.pl -- -- begin server.pl 8< -- package HelloWorld; use SOAP::Lite; use base qw(SOAP::Server::Document); sub sayHello { my $self = shift; my $doc = shift; my $som = shift; my $ret_val = some_processing_method($doc); return $ret_val; } -- end of server.pl -- The client builds an XML document inserts it into the request using the document() method on the SOAP object. The client subclasses from SOAP::Server::Document so it gets the XML payload as the second argument on the stack, processes it somehow, and returns an XML payload back to the client. feedback? Cheers, jas. |