#24 WSDL parsing and sequence ordering in complexTypes

open
Martin Kutter
None
3
2007-10-03
2004-10-07
Anonymous
No

I have a SOAP service that returns an complexType that looks like
this:

<complexType name="PintoBean">
<sequence>
<element name="comment" type="string">
<element name="tastiness" type="int">
</sequence>
</complexType>

I can call a method like this:
$bean = $svc->getPintoBean($beanID);

And iterate it like this:
while (my ($key, $value) = each (%$bean)) {
print "$key = $value\n";
}

However, when I go to put it back like this:
$svc->maptype(PintoBean => 'urn:simpleBean'});
$result = $svc->putPintoBean(SOAP::Data->value(bless $bean,
PintoBean);

My call succeeds or fails randomly, because hashes are unordered
and sometimes the message sent to the server puts 'comment'
AFTER 'tastiness' in which case my server (Java Web Services Dev
Pack) croaks saying that it's an invalid message which is true.

Now I can get around that by doing this:
$result = $svc->putPintoBean(SOAP::Data-
>type('ordered_hash', [
'comment' => $bean->{comment}, 'tastiness' =>$bean-
>{tastiness}

However, this forces me in the client to know the ordering of the
fields in the complexType (something that WSDL already knows).

Discussion

  • Martin Kutter
    Martin Kutter
    2007-10-03

    • labels: 536485 -->
    • priority: 5 --> 3
    • assigned_to: byrnereese --> kutterma
     
  • Martin Kutter
    Martin Kutter
    2007-10-03

    Logged In: YES
    user_id=884175
    Originator: NO

    We should first really support complexTypes, and then talk about order.

    In the meantime, try SOAP::WSDL (the 2.x pre-release versions)