|
From: Martin K. <mar...@fe...> - 2008-09-18 11:17:33
|
Hi Jason,
forcing the server developer to create XML may or may not be a good
idea, depending on it's complexity.
How about making the proposed SOAP::Server::Document a bit more DWIM by
accepting either a scalar (which is supposed to be plain XML) or a
SOAP::Data object?
This would ease migration for existing web services which want to move
to SOAP::Server::Document
Maybe SOAP::Lite::Server::Document would be the more appropriate name -
the use of the SOAP namespace has provoked numerous errors on CPAN, so
SOAP::Lite is a better namespace for new modules.
Thanks for your ideas,
Martin
Am Donnerstag, den 18.09.2008, 14:10 +0530 schrieb Jason Stewart:
> 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.
>
|