From: Jason S. <jas...@gm...> - 2008-09-08 15:58:50
|
Hey Soapers, I'm trying to get a grip on the claims of SOAP::Lite supporting document/literal. I have a contract that will pay me to implement full doc/literal support in S::L - but I just need to figure out what is there, what is working, what isn't, and what needs to get done. I just wrote a message to the developers of the MOBY project - heavy consumers of S::L - and got this response. Martin, do you or anyone else have a response to Eddies problem of how to include attributes in the output message? Cheers, jas. ---------- Forwarded message ---------- From: Edward Kawas <edw...@gm...> Date: Mon, Sep 8, 2008 at 8:46 PM Subject: Re: [MOBY-dev] SOAP::Lite claims support for document/literal To: Core developer announcements <mob...@li...> Hi Jason, One of the problems that I have with soap lite and trying to perform doc/lit requests/responses is the inability to use attributes in the request. Since that statement doesn't make too much sense (to some it might have ;-), I will provide an example: I modified the wsdl that you sent to include an attribute in the givenName element, so that a request now looks like: <q0:sayHello> <name>Joe Blow</name> <givenName middlename="Windy">Joe</givenName> </q0:sayHello> The server side code is simply: sub sayHello { SOAP::Data->name('sayHelloResult')->value( Dumper(\@_) ); } So all that I am doing is dumping whatever is sent to the server. The response is <sayHelloResponse xmlns="urn:HelloWorld"> <sayHelloResult xsi:type="xsd:string">$VAR1 = [ 'HelloWorld', 'Joe Blow', 'Joe' ];</sayHelloResult> </sayHelloResponse> I do believe that this is one of the biggest stumbling blocks so far. Because numerous Moby api calls use attributes. One such example is the retrieveService call. My dispatcher code is below! Eddie ------ CODE START ----- #!/usr/bin/perl -w # _________________________________________________________________ use SOAP::Transport::HTTP; if ($ENV{REQUEST_METHOD} eq "GET") { if (lc($ENV{QUERY_STRING} || "") eq "wsdl") { require CGI; my $q = CGI->new(); my $wsdl = HelloWorld::wsdl(); my $c = length($wsdl); print $q->header(-type=>'application/xml',-Content-length=>$c); print "$wsdl"; } } else { my $x = new SOAP::Transport::HTTP::CGI; $x->dispatch_to('/var/www/cgi-bin', 'HelloWorld'); $x->handle; } package HelloWorld; use Data::Dumper; sub sayHello { SOAP::Data->name('sayHelloResult')->value( Dumper(\@_) ); } sub wsdl { return <<EOF; <?xml version="1.0" encoding="UTF-8" ?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:HelloWorld" targetNamespace="urn:HelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema targetNamespace="urn:HelloWorld"> <s:element name="sayHello"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="givenName" nillable="1"> <s:complexType> <s:simpleContent> <s:extension base="s:string"> <s:attribute name="middlename" use="required" type="s:string"> </s:attribute> </s:extension> </s:simpleContent> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element> <s:element name="sayHelloResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="sayHelloResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types> <message name="sayHelloSoapIn"> <part name="parameters" element="s0:sayHello" /> </message> <message name="sayHelloSoapOut"> <part name="parameters" element="s0:sayHelloResponse" /> </message> <portType name="Service1Soap"> <operation name="sayHello"> <input message="s0:sayHelloSoapIn" /> <output message="s0:sayHelloSoapOut" /> </operation> </portType> <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sayHello"> <soap:operation soapAction="urn:HelloWorld#sayHello" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="HelloWorld"> <port name="HelloWorldSoap" binding="s0:Service1Soap"> <soap:address location="http://ubuntu.localhost/cgi-bin/doc-lit.pl" /> </port> </service> </definitions> EOF } 1; ------ CODE END ------ -----Original Message----- From: mob...@li... [mailto:mob...@li...] On Behalf Of Jason Stewart Sent: September-08-08 4:07 AM To: Core developer announcements Subject: [MOBY-dev] SOAP::Lite claims support for document/literal Hey Moby-devs, The version of SOAP::Lite in CVS claims to support Document/literal encoding - I need help determing if this support is sufficient. Can you look this over? =head3 DOCUMENT/LITERAL SOAP web services using the document/literal message encoding are usually described by some Web Service Definition. Our web service has the following WSDL description: <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="urn:HelloWorld" targetNamespace="urn:HelloWorld" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema targetNamespace="urn:HelloWorld"> <s:element name="sayHello"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="name" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="givenName" type="s:string" nillable="1" /> </s:sequence> </s:complexType> </s:element> <s:element name="sayHelloResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="sayHelloResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> </types> <message name="sayHelloSoapIn"> <part name="parameters" element="s0:sayHello" /> </message> <message name="sayHelloSoapOut"> <part name="parameters" element="s0:sayHelloResponse" /> </message> <portType name="Service1Soap"> <operation name="sayHello"> <input message="s0:sayHelloSoapIn" /> <output message="s0:sayHelloSoapOut" /> </operation> </portType> <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sayHello"> <soap:operation soapAction="urn:HelloWorld#sayHello"/> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="HelloWorld"> <port name="HelloWorldSoap" binding="s0:Service1Soap"> <soap:address location="http://localhost:80//helloworld.pl" /> </port> </service> </definitions> The XML message (inside the SOAP Envelope) look like this: <sayHello xmlns="urn:HelloWorld"> <name>Kutter</name> <givenName>Martin</givenName> </sayHello> <sayHelloResponse> <sayHelloResult>Hello Martin Kutter!</sayHelloResult> </sayHelloResponse> You can call this web service with the following client code: use SOAP::Lite; my $soap = SOAP::Lite->new( proxy => 'http://localhost:80/helloworld.pl'); $soap->on_action( sub { "urn:HelloWorld#sayHello" }); $soap->autotype(0); $soap->default_ns('urn:HelloWorld'); my $som = $soap->call("sayHello", SOAP::Data->name('name')->value( 'Kutter' ), SOAP::Data->name('givenName')->value('Martin'), ); die $som->fault->{ faultstring } if ($som->fault); print $som->result, "\n"; =head2 Differences between the implementations You may have noticed that there's no between the rpc/literal and the document/literal example's implementation. In fact, from SOAP::Lite's point of view, the only differences between rpc/literal and document/literal that parameters are always named. In our example, the rpc/literal variant already used named parameters (by using a single complexType only as positional parameter), so there's no difference at all. The differences would have been bigger if the rpc/literal example had used more than one positional parameter, but this is quite unlikely to happen in the future: Current interoperability standards (like the WS-I basic profile) mandate the use of a single complexType as only parameter in rpc/literal calls. -- snip -- Help me on this one - is this valid? Is it sufficient for what MOBY and the rest of the Perl world needs? I suggest that I test this claim against: * perl SOAP::Lite client = axis Java server * java client = perl SOAP::Lite server I could use some suggestions for how to make these tests useful. Cheers, jas. _______________________________________________ MOBY-dev mailing list MOB...@li... http://lists.open-bio.org/mailman/listinfo/moby-dev _______________________________________________ MOBY-dev mailing list MOB...@li... http://lists.open-bio.org/mailman/listinfo/moby-dev |