Re: Newbie question: simple complex type
- Thank you so much for the reply, that was most excellent,
man I wish I could E-mail you a beer !
(hm, well there is an idea).
I have copied the working code below for posterity.
One question I should have asked before:
I am to implement both the server and client side of
a web service, the server will be Java, the clients will
be both perl and Java.
Now.. the application requires me to pass in and return
a "deep structure" which can be represented as an array
of structs (few hundred items in the array, some 5 fields
in the struct).
Would it make more sense to keep the method call simple and
pass in the structure as a "blob", i.e. an attachment to
be parsed by the server side or is that just "not done"
in web sevices land ?
(The question is thus related to best practices)
Sample code for interfacing with "example5" of the Apache axis 1.3
distribution, thanks much to Eric Bridger
use SOAP::Lite +trace => qw(debug);
$method = SOAP::Data->name("processOrder");
# from the wsdl:
# <complexType name="Order">
# <element name="customerName" nillable="true"
# <element name="itemCodes" nillable="true"
# <element name="quantities" nillable="true"
# <element name="shippingAddress" nillable="true"
my $order = SOAP::Data->name("arg1" =>
\SOAP::Data->value( # note the reference here to get nested XML
SOAP::Data->name("customerName" => 'foo' ),
SOAP::Data->name("itemCodes" => ['a','b'] ),
SOAP::Data->name("quantities" => [1,2] ),
SOAP::Data->name("shippingAddress" => 'addr' ),
$result = $serv->call($method,
->name("arg1" => $order ) );