Thread

Posted on Tue Jun 24 19:11:55 2008 by blogzen
Question about generated type module from wsdl2perl
HI, I have xml schema defined as:
<xsd:complexType name="ArrayOfMyType"> <xsd:sequence> <xsd:element name="item" type="MyType" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType>
wsdl2perl generates ArrayOfMyType.pm which has document like this:
Constructor. The following data structure may be passed to new(): { # ArrayOfMyType item => { # MyType # properties of MyType }, },
Looks like it should be a hash, but how could it have multiple entries with the same key 'item'? In my schema definition I declared that 'item' could repeat inside of ArrayOfMyType. Thanks,
Direct Responses: 8155 | Write a response
Posted on Tue Jun 24 20:16:42 2008 by blogzen in response to 8149
Re: Question about generated type module from wsdl2perl
I tried to have something like this in request:
test_type => [ { item => {...}, }, { item => {...}, }, ],
basically an array ref of hash refs. The request it sends looks like:
<test_type> <item> ... </item> </test_type> <test_type> <item> ... </item> </test_type>
But what I really want is:
<test_type> <item> ... </item> <item> ... </item> </test_type>
So is it a bug in SOAP::WSDL?
Direct Responses: 8158 | Write a response
Posted on Tue Jun 24 22:57:38 2008 by mkutter in response to 8155
Re: Question about generated type module from wsdl2perl
SOAP::WSDL expects list refs to be at the last possible position. Thus, the following is interpreted as a list of test_type elements:
test_type => [ { item => {...}, }, { item => {...}, }, ],
To make it send a list of item elements, try
test_type => { item => [ ... ] }

Martin
Direct Responses: 8159 | Write a response
Posted on Tue Jun 24 23:13:26 2008 by blogzen in response to 8158
Re: Question about generated type module from wsdl2perl
Yes, the way you suggested works, although it's kinda counter-intuitive :) Thanks,
Write a response