[Xml-compile] Fault when required child within optional parent node

Thibadeau, Daniel dan.thibadeau at hp.com
Sat Aug 19 15:20:14 GMT 2017


Thanks for the quick response.  You were exactly right, the response contained an empty <payment_information/>   element.  I'll talk to the server owner to fix.

Now that you pointed it out it seems obvious.  I was looking in the wrong place.  I did learn a lot reading through your code looking for hints.  I haven't used "closures" before, but will be playing around with them for days to learn more :)

Dan T.

-----Original Message-----
From: Mark Overmeer [mailto:mark at overmeer.net] 
Sent: Saturday, August 19, 2017 4:14 AM
To: Thibadeau, Daniel <dan.thibadeau at hp.com>
Cc: xml-compile at lists.scsys.co.uk
Subject: Re: [Xml-compile] Fault when required child within optional parent node

* Thibadeau, Daniel (dan.thibadeau at hp.com) [170819 04:29]:
> error: decode error: data for element or block starting with 
> `amount_collect' missing at 
> tns:calculateTaxOnCteDataModelResponse/return/cte_document/document_he
> ader/payment_information
> 
> My request does not contain the "payment_information" element, so the 
> response is also missing that element (as expected).  The fault 
> message seems to only be on the response and not the request.

Yes, decoding is performed on the received message.  Also, the element named *Response.

> I believe this should be a valid WSDL configuration.  I do get back a 
> valid/expected response in $answer

I expect that the response contains an empty <payment_information/>   But
it may also be not empty with an unexpected or out-of-order field.

See $trace->printResponse(pretty_print => 1);

> What can I do to prevent the error?

Fix the schema or server ;-)

> Should the printErrors() method be printing the error twice?

The first error is only the last (fatal) issue.  After that, it lists all issues, sometimes with more information.
--
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list