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

Hi - I'm able to use SOAP::Lite to generate XML containing simple variables, but my client code now has to talk to a server which expects input like this...
<soapenv:Envelope> <soapenv:Body> <ns1:aMethod> <in0 href="#id0"/> </ns1:aMethod> <multiRef id="id0"> <var1 xsi:type="xsd:boolean">true</var1> <var2 xsi:type="xsd:dateTime">2004-01-23T23:09:49.460Z</var2> <var3 xsi:type="xsd:string">hello</var3> </multiRef> </soapenv:Body> </soapenv:Envelope>
I've read the SOAP::Lite perldocs but can't work out how to generate that multiref tag. Can anyone point me in the right direction? Thanks - Jon

Replies are listed 'Best First'.
Re: Generating multiref tags from SOAP::Lite
by Amsterdamned (Novice) on Jan 29, 2004 at 12:19 UTC
    Hi -

    My problem turned out to be a soap one not a perl one

    It looks like SOAP::Lite only adds multireferences if they are actually used (which is sensible). The example XML I was trying to follow was misleading because it included an unnecessary multiref. The issue was actually a bad URI so the code is working now

    Thanks to neuroball for replying :-)

Re: Generating multiref tags from SOAP::Lite
by neuroball (Pilgrim) on Jan 28, 2004 at 16:15 UTC

    Next time you might want to also search the Soap::Lite documentation. If you did, you might have found the following lines of advise:

    multirefinplace() Shortcut for serializer->multirefinplace(). If true, the serialize +r will put values for multireferences in the first occurrence of the referenc +e. Otherwise it will be encoded as top independent element, right aft +er method element inside Body. Default value is false.

    The meaning of the above is, that you have to set multirefinplace() to true, to make SOAP::Lite add the multireferences

    /oliver/

      Hi Oliver -

      I'd found multirefinplace() but couldn't get it to work. The following code produces the same XML with or without multirefinplace()

      use SOAP::Lite +trace => qw( debug ); my $param = SOAP::Data ->type('myType') ->name('in0' => \SOAP::Data->value( SOAP::Data->new(name => 'var1', type => 'xsd:boolean', value => +"true" ), SOAP::Data->new(name => 'var3', type => 'xsd:string', value => " +hello" ), )); SOAP::Lite -> service('http://www.xmethods.net/sd/StockQuoteService.wsdl') -> multirefinplace(1) -> getQuote($param);

      - Jon