winfinit has asked for the wisdom of the Perl Monks concerning the following question:

hi Monks, i am trying to create an interface between weird system, here is XML that i am expected to send:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <test1> <data>2</data> <wierd href="#id1"/> <test1> <wierd2 id="id1"> <someotherdata>10</someotherdata> <evenmorewierd href="#id2"/> <wierd2> <lastmethod id="id2"> <moredata>4</moredata> </lastmethod> </soap:Body> </soap:Envelope>
now i wrote this little peace (not gonna include everyhitng for client, if needed, can drop everything)
my @data = ( SOAP::Data->name('test1' => \SOAP::Data->value(SOAP::D +ata->name('data' => 2),SOAP::Data->name('wierd')->attr({'href'=>'#id1 +'}))), SOAP::Data->name('wierd2' => \SOAP::Data->value(SOAP:: +Data->name('someotherdata'=>10),SOAP::Data->name('evenmorewierd')->at +tr({'href'=>'#id2'}))->attr({'id'=>'id1'})), SOAP::Data->name('lastmethod' => \SOAP::Data->value(SO +AP::Data->name('moredata'=>4))->attr({id=>'id2'})) ); $cleint->on_action(sub{'https:/blah/wierdserver.asmx'}); $client->call(@data);
but that is not producing desired result, i never saw before multiple methods, or that kind of use of complex data types in SOAP, and all my tries are unsuccessful... please help!

Replies are listed 'Best First'.
Re: how to use class reference with SOAP::Lite
by holli (Abbot) on Apr 22, 2008 at 22:28 UTC
    What version of SOAP::Lite are you using? The one currently on CPAN (0.71.04) is marked as unauthorized and may be buggy.


    holli, /regexed monk/
Re: how to use class reference with SOAP::Lite
by jhourcle (Prior) on Apr 23, 2008 at 18:12 UTC

    The 'id' and 'href' values are typically signs of encoding when you have more than one reference to a value. However, in your case, the id comes _after_ the href, which is backwards for how SOAP::Lite handles its serialization.

    Of course, the exact values of the ids shouldn't be important, provided that the deserializer can reconstruct the message correctly. This isn't exactly the correct xml message, but it'll at least show the behavior of the serializer when there's references used multiple times: