document/literal style SOAP:Lite service

F

Fima Furman

Folks, this seems like a pretty basic question, but I couldn't find a
direct answer, only hints in documentation and other people's article.
Can Soap:Lite implement a service which would work with Document/
literal requests? In my testing I was only able to get it to work with
rpc/encoded style. I would very much appreciate if someone could shed
some light on this.

If Soap:lite is incompatible with document/literal, are there
alternatives out there which would allow to implement document/literal
SOAP service in Pearl? I've asked the same question in Soap:Lite yahoo
group and total silence was my answer.

Thanks!
 
I

Ian Wilson

Fima said:
Folks, this seems like a pretty basic question, but I couldn't find a
direct answer, only hints in documentation and other people's article.
Can Soap:Lite implement a service which would work with Document/
literal requests? In my testing I was only able to get it to work with
rpc/encoded style. I would very much appreciate if someone could shed
some light on this.

SOAP::Lite really only supports RPC/Encoded. The SOAP::Lite
documentation mentions partial support for Doc/Literal but I believe
this never advanced beyond some rudimentary and partial support.
If Soap:lite is incompatible with document/literal, are there
alternatives out there which would allow to implement document/literal
SOAP service in Pearl? I've asked the same question in Soap:Lite yahoo
group and total silence was my answer.

AFAIK There are no alternative modules that do what you want.

I'd love to hear if I am wrong about either of the above!


The good news is that the following process works beautifully:

* Create a SOAP::Lite service in the usual way.

* If you receive or send complex data structures,
Use Perl objects
Return references to arrays instead of arrays
Do not use perl data structures like HoH
Do not use SOAP::Data to construct params or return values.

* Mark up your Perl objects following the instructions
in the POD::WSDL documentation

* Use POD::WSDL to create WSDL for the service

* Use that WSDL to create stubs in technologies that
normally only like Doc/Literal
e.g. C# .NET
I downloaded mono and used it's wsdl.exe to create a
C# stub from the WSDL created by POD::WSDL

* Use those stubs in the normal way.
I could write normal C# code, constructing C# objects and passing
them as params to Perl SOAP::Lite services via methods of a stub
service object. Perl objects emerge as C# objects and vice-versa.

* The receiving Perl service receives full Perl objects
and you can invoke instance methods using those
objects!

I have done this with moderately complex parameters such as an array of
objects where each object contains various fields and an array of
another type of object.

Note that the C# programmer does not have to even know about the
distinction between RPC/Encoded and Doc/Literal. Everything just works.

I haven't tried this with Perl's inside-out objects, just the original
traditional hash based objects. The C# classes created in the stub for
the parameter and return objects obviously lack methods and accessors,
you just refer to public variables (fields) using object.field notation

Perl service

my @things;
my $thing = new Thing(1,99.9,"aha");
$thing->addWhatsit("foo", 23.3); # inner array of Whatsit objects
$thing->addWhatist("bar", 23.3);
push @things $thing;
$thing = new Thing(2,34.2,"oho");
return \@things;

C# client

// stub gen from WSDL defines ThingService, Thing and Whatsit.
ThingService service = new ThingService();
Thing[] things = service.method(params);
for (int i = 0; i < things.Length; i++) {
Whatsit[] whatsits = things.whatsits;
for (int j = 0; j < whatsits.Length; j++) {
Console.WriteLine("This Things contains a Whatsit with name "
+ whatsits[j].name);
}
}

No hint of RPC/Encoded or Doc/Literal anywhere in the code you have to
write.
 
F

Fima Furman

Ian,

Thank you so much for such a detailed reply! It's amazing this
information isn't really out there. Can you recommend a Soap::Lite
version I should use? The latest non-experimental version is 0.60a,
however there are versions up to .69 available.

Thanks, again

Fima.
 
I

Ian Wilson

Fima said:
Thank you so much for such a detailed reply! It's amazing this
information isn't really out there.

Yes, I spent *many* days struggling with this issue and explored many
dead ends. Useful tools included SOAP::Lite's +trace option, Wireshark
and an XML prettyprinter/indenter.

Can you recommend a Soap::Lite version I should use? The latest
non-experimental version is 0.60a, however there are versions up to
.69 available.

Here's what I am using ...

Unix Server:
$ perl -MSOAP::Lite -e 'print "$SOAP::Lite::VERSION\n"'
0.55

Development PC (WinXP):
C:\> perl -MSOAP::Lite -e "print qq($SOAP::Lite::VERSION\n)"
0.55

Looks like I'm using rather old versions :-o

I recommend you use whatever comes as standard on your platform. If it
doesn't work, I'd upgrade to the latest stable version available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top