[Xml-compile] Problem with choice
Drew Taylor
drew at drewtaylor.com
Tue Apr 22 18:08:15 BST 2008
On 22 Apr 2008, at 17:23, Drew Taylor wrote:
> I apologize in advance for such a long post!
>
> I'm having an issue with an end-to-end test which is testing for
> errors in messages. Using X::C::WSDL, I create a client and send off
> a request to the server (it's Catalyst but I don't think that's
> relevant). The incoming and outgoing SOAP messages are below. In
> this particular case, I'm leaving off PackageRequest/DateRange/Start
> to test my error checking. I can see the warning message in the
> response, so that part is working correctly. However, the client
> gives me an error when trying to read in the response and parse it.
>
> If I put back the PackageRequest/DateRange/Start element everything
> works fine. There must be something simple I'm overlooking... It
> seems crazy that I can't test failure scenarios because X::C is
> saving me from my (intentional) errors. :-)
>
> Drew
>
> Client:
> my $wsdl = XML::Compile::WSDL11->new($xml);
> my $client = $wsdl->compileClient($message,
> port => $message.'Port', transport_hook => \&proxy_to_test_app,
> );
> # $params is the monster data structure to be sent
> $params->{PackageRequest}{DateRange} = {Duration => 'P7N'}; #
> testing lack of Start element
> ($answer, $trace) = $client->( { body => $params } );
>
> Gives:
> error: no applicable choice for `Success' at {http://www.opentravel.org/OTA/2003/05
> }TTI_PkgBookRS
OK, I figured it out. :-) Turns out the response was NOT valid
according to the schema. It was missing a required element
"Accommodation" deep down in PackageReservation/Package/ItineraryItems/
ItineraryItem.
So I guess the real question is: why was the client telling me that it
was having a problem finding a choice for the wrong element? And how
did this pass the server-side check? I thought it was more stringent
about these things? On my side, I'll dig into the schemas and see if
Accommodation was required or optional and any other relevant bits.
Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20080422/7873bbce/attachment.htm
More information about the Xml-compile
mailing list