[MOBY-dev] SOAP::Lite claims support for document/literal
Jason Stewart
jason.e.stewart at gmail.com
Mon Sep 8 11:06:59 UTC 2008
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.
More information about the MOBY-dev
mailing list