Loading ...
Sorry, an error occurred while loading the content.

WSDL complexTypes and sequence

Expand Messages
  • harbica
    I have a SOAP service that returns an complexType that looks like this:
    Message 1 of 1 , Nov 4, 2003
    • 0 Attachment
      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).

      Personally, this looks like a bug in SOAP::Lite to me, but I'm not terribly familiar with
      SOAP::Lite. Can someone tell me if I'm doing something wrong?

      Thanks,
      Andy
    Your message has been successfully submitted and would be delivered to recipients shortly.