Dear Monks:
I have a client that passes an ArrayOfEventModel object to a web service. Please refer to the following:

my $data; #...... accumilate information in $data ...... my $events = ArrayOfEventModel->new($data); my $soap; my $som; eval { $soap = SOAP::Lite -> uri(WS_URI()) -> proxy(WS_PROXY()) -> on_action( sub { sprintf '""', @_ } ) -> on_debug( sub { print @_ } ) -> on_fault( sub { } ) ; $som = $soap->processEvent(SOAP::Data->name('arrayOfEventModel +_1')->type(ArrayOfEventModel=>$events)); }; # examines fault and dies if it finds one get_error( $som, $@ );

that throws the following error:

(faultcode) env:Client: (faultdetail) JAXRPC.TIE.01: caught exception while handling request: +deserialization error: unexpected XML reader state. expected: END but + found: START: boroughID

So, $events is an array of EventModel objects, which (like most objects in perl) are hashes. When my request object is created (viewed by printing the debug information):

.............. <arrayOfEventModel_1 xsi:type="SOAP-ENC:ArrayOfEventModel" + SOAP-ENC:arrayType="namesp1:EventModel[1]"> <item xsi:type="namesp1:EventModel"> <name xsi:type="xsd:string">Name</name> <boroughID xsi:type="xsd:int">3</boroughID> <agencyDept xsi:type="xsd:string">Department* </ag +encyDept> <status xsi:type="xsd:string">p</status> <eventImage xsi:type="xsd:string">http://image</ev +entImage> .............

the attributes do not appear in the same order as they are in my WSDL:

....................... <complexType name="ArrayOfEventModel"> <complexContent> <restriction base="soap11-enc:Array"> <attribute ref="soap11-enc:arrayType" wsdl:arrayType="tns: +EventModel[]"/></restriction></complexContent></complexType> <complexType name="EventModel"> <sequence> <element name="ID" type="string"/> <element name="address1" type="string"/> <element name="address2" type="string"/> <element name="address3" type="string"/> <element name="agencyAcronym" type="string"/> <element name="agencyDept" type="string"/> <element name="boroughID" type="int"/> .............................

Is this the reason the error is being thrown?
If so, how do I force a certain order of xml tags in my request?
If not, what else could be causing the problem?

Any thoughts would be appreciated.

Thanks,
Rob


In reply to Trouble Passing Objects using SOAP::Lite by fogues

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.