Skip Menu |

This queue is for tickets about the XML-Compile CPAN distribution.

Report information
The Basics
Id: 102832
Status: resolved
Priority: 0/
Queue: XML-Compile

People
Owner: Nobody in particular
Requestors: mjgardner [...] cpan.org
Cc: peter.sandin [...] ziprecruiter.com
AdminCc:

Bug Information
Severity: Important
Broken in: 1.48
Fixed in: (no value)



CC: peter.sandin [...] ziprecruiter.com
Subject: decode error in XML::Compile::Translate::Reader when element with value 0 follows subtree
Using XML::Compile::WSDL11 in conjunction with the Avalara tax service at https://development.avalara.net/tax/taxsvc.wsdl (docs here: http://developer.avalara.com/api-reference). I'm getting an "error: decode error: data for element or block starting with `ExemptCertId' missing at tns:GetTaxResponse/GetTaxResult/TaxLines/TaxLine" error in the response to a GetTax operation. I've attached a text file containing the error, SOAP request and SOAP response. My guess is that a bug is being triggered because the ExemptCertId has a text value of 0 and follows the TaxDetails subtree, but I'm not 100% sure. Thanks!
Subject: avalara_out.txt
error: decode error: data for element or block starting with `ExemptCertId' missing at tns:GetTaxResponse/GetTaxResult/TaxLines/TaxLine User-Agent: libwww-perl/6.08 Content-Length: 2634 Content-Type: text/xml; charset="utf-8" SOAPAction: http://avatax.avalara.com/services/GetTax X-LWP-Version: 6.08 X-XML-Compile-Cache-Version: 1.03 X-XML-Compile-SOAP-Version: 3.07 X-XML-Compile-Version: 1.48 X-XML-LibXML-Version: 2.0116 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <tns:Profile xmlns:tns="http://avatax.avalara.com/services"> <tns:Client>./avalara_test.pl,</tns:Client> <tns:Adapter>WebService::Avalara::AvaTax,0.013</tns:Adapter> <tns:Machine>www.ziprecruiter-mjg.com</tns:Machine> </tns:Profile> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" SOAP-ENV:mustUnderstand="1"> <wsse:UsernameToken xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:Username>mjg@ziprecruiter.com</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">FAQ63/dipped</wsse:Password> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <tns:GetTax xmlns:tns="http://avatax.avalara.com/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tns:GetTaxRequest> <tns:CompanyCode>zrinc</tns:CompanyCode> <tns:DocType>SalesInvoice</tns:DocType> <tns:DocDate>2015-03-16</tns:DocDate> <tns:CustomerCode>test</tns:CustomerCode> <tns:Discount>0</tns:Discount> <tns:OriginCode>0</tns:OriginCode> <tns:DestinationCode>1</tns:DestinationCode> <tns:Addresses> <tns:BaseAddress> <tns:AddressCode>0</tns:AddressCode> <tns:Line1>1453 3rd St Ste 335</tns:Line1> <tns:City>Santa Monica</tns:City> <tns:PostalCode>90401-3425</tns:PostalCode> <tns:TaxRegionId>0</tns:TaxRegionId> </tns:BaseAddress> <tns:BaseAddress> <tns:AddressCode>1</tns:AddressCode> <tns:Line1>57 Mattix Run</tns:Line1> <tns:City>Galloway</tns:City> <tns:PostalCode>08205</tns:PostalCode> <tns:TaxRegionId>0</tns:TaxRegionId> </tns:BaseAddress> </tns:Addresses> <tns:Lines> <tns:Line> <tns:No>1</tns:No> <tns:OriginCode>0</tns:OriginCode> <tns:ItemCode>no-plan-trafficboost</tns:ItemCode> <tns:Qty>1</tns:Qty> <tns:Amount>95</tns:Amount> <tns:Discounted>false</tns:Discounted> </tns:Line> <tns:Line> <tns:No>2</tns:No> <tns:OriginCode>0</tns:OriginCode> <tns:ItemCode>np-plan-trafficboost</tns:ItemCode> <tns:Qty>1</tns:Qty> <tns:Amount>245</tns:Amount> <tns:Discounted>false</tns:Discounted> </tns:Line> </tns:Lines> <tns:DetailLevel>Tax</tns:DetailLevel> <tns:HashCode>0</tns:HashCode> <tns:Commit>false</tns:Commit> <tns:ServiceMode>Automatic</tns:ServiceMode> <tns:PaymentDate>2015-03-16</tns:PaymentDate> <tns:ExchangeRate>1</tns:ExchangeRate> <tns:ExchangeRateEffDate>2015-03-16</tns:ExchangeRateEffDate> </tns:GetTaxRequest> </tns:GetTax> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Date: Tue, 17 Mar 2015 18:21:07 GMT Content-Length: 3733 Content-Type: text/xml; charset=utf-8 Client-Date: Tue, 17 Mar 2015 18:20:45 GMT Client-Peer: 204.76.29.84:443 Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3 Client-SSL-Cert-Subject: /C=US/ST=Washington/L=Bainbridge Island/O=Avalara, Inc./OU=Terms of use at www.verisign.com/rpa (c)05/CN=development.avalara.net Client-SSL-Cipher: RC4-SHA Client-SSL-Socket-Class: Net::SSL Client-SSL-Warning: Peer certificate not verified Set-Cookie: TS6198e2=fa0bf0571553458f5795eeb04c4c4bc267e5e49c255bd1e455087093; Path=/ Set-Cookie: TS6198e2_28=832b11d6c45bb9d68b1560524d854e2967e5e49c255bd1e4000000000000000000550870939bd2121bb385b8ca; Path=/ X-Powered-By: ASP.NET <?xml version="1.0"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <GetTaxResponse xmlns="http://avatax.avalara.com/services"> <GetTaxResult> <TransactionId>1035423622</TransactionId> <ResultCode>Success</ResultCode> <DocId>76776081</DocId> <DocType>SalesInvoice</DocType> <DocCode>62b6dd01-89f9-4a83-88c4-2a51133961a0</DocCode> <DocDate>2015-03-16</DocDate> <DocStatus>Saved</DocStatus> <Reconciled>false</Reconciled> <Timestamp>2015-03-17T18:21:07.613</Timestamp> <TotalAmount>340</TotalAmount> <TotalDiscount>0</TotalDiscount> <TotalExemption>0</TotalExemption> <TotalTaxable>340</TotalTaxable> <TotalTax>23.8</TotalTax> <TotalTaxCalculated>23.8</TotalTaxCalculated> <HashCode>0</HashCode> <TaxLines> <TaxLine> <No>1</No> <TaxCode>DA010000</TaxCode> <Taxability>true</Taxability> <BoundaryLevel>Address</BoundaryLevel> <Exemption>0</Exemption> <Discount>0</Discount> <Taxable>95</Taxable> <Rate>0.070000</Rate> <Tax>6.65</Tax> <TaxCalculated>6.65</TaxCalculated> <TaxIncluded>false</TaxIncluded> <TaxDetails> <TaxDetail> <Country>US</Country> <Region>NJ</Region> <JurisType>State</JurisType> <JurisCode>34</JurisCode> <TaxType>Sales</TaxType> <Base>95</Base> <Taxable>95</Taxable> <Rate>0.070000</Rate> <Tax>6.65</Tax> <TaxCalculated>6.65</TaxCalculated> <NonTaxable>0</NonTaxable> <Exemption>0</Exemption> <JurisName>NEW JERSEY</JurisName> <TaxName>NJ STATE TAX</TaxName> <TaxAuthorityType>45</TaxAuthorityType> <TaxGroup/> <RateType>G</RateType> <StateAssignedNo/> </TaxDetail> </TaxDetails> <ExemptCertId>0</ExemptCertId> <TaxDate>2015-03-16</TaxDate> <ReportingDate>2015-03-16</ReportingDate> <AccountingMethod>Accrual</AccountingMethod> </TaxLine> <TaxLine> <No>2</No> <TaxCode>P0000000</TaxCode> <Taxability>true</Taxability> <BoundaryLevel>Address</BoundaryLevel> <Exemption>0</Exemption> <Discount>0</Discount> <Taxable>245</Taxable> <Rate>0.070000</Rate> <Tax>17.15</Tax> <TaxCalculated>17.15</TaxCalculated> <TaxIncluded>false</TaxIncluded> <TaxDetails> <TaxDetail> <Country>US</Country> <Region>NJ</Region> <JurisType>State</JurisType> <JurisCode>34</JurisCode> <TaxType>Sales</TaxType> <Base>245</Base> <Taxable>245</Taxable> <Rate>0.070000</Rate> <Tax>17.15</Tax> <TaxCalculated>17.15</TaxCalculated> <NonTaxable>0</NonTaxable> <Exemption>0</Exemption> <JurisName>NEW JERSEY</JurisName> <TaxName>NJ STATE TAX</TaxName> <TaxAuthorityType>45</TaxAuthorityType> <TaxGroup/> <RateType>G</RateType> <StateAssignedNo/> </TaxDetail> </TaxDetails> <ExemptCertId>0</ExemptCertId> <TaxDate>2015-03-16</TaxDate> <ReportingDate>2015-03-16</ReportingDate> <AccountingMethod>Accrual</AccountingMethod> </TaxLine> </TaxLines> <TaxAddresses> <TaxAddress> <Address>57 Mattix Run</Address> <AddressCode>1</AddressCode> <BoundaryLevel>0</BoundaryLevel> <City>Galloway</City> <Country>US</Country> <PostalCode>08205</PostalCode> <Region>NJ</Region> <TaxRegionId>2118369</TaxRegionId> <JurisCode>3400000000</JurisCode> <Latitude/> <Longitude/> <GeocodeType>StreetLevel</GeocodeType> <ValidateStatus>NormalHit</ValidateStatus> <DistanceToBoundary>0</DistanceToBoundary> </TaxAddress> <TaxAddress> <Address>1453 3rd St Ste 335</Address> <AddressCode>0</AddressCode> <BoundaryLevel>2</BoundaryLevel> <City>Santa Monica</City> <Country>US</Country> <PostalCode>90401-3425</PostalCode> <Region>CA</Region> <TaxRegionId>0</TaxRegionId> <JurisCode>0600000000</JurisCode> <Latitude/> <Longitude/> <GeocodeType/> <ValidateStatus>Not Validated</ValidateStatus> <DistanceToBoundary>0</DistanceToBoundary> </TaxAddress> </TaxAddresses> <Locked>false</Locked> <AdjustmentReason>0</AdjustmentReason> <AdjustmentDescription/> <Version>1</Version> <TaxDate>2015-03-16</TaxDate> <TaxSummary/> <VolatileTaxRates>false</VolatileTaxRates> </GetTaxResult> </GetTaxResponse> </s:Body> </s:Envelope>
Subject: Re: [rt.cpan.org #102832] decode error in XML::Compile::Translate::Reader when element with value 0 follows subtree
Date: Tue, 17 Mar 2015 20:52:27 +0100
To: Mark Gardner via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Mark Gardner via RT (bug-XML-Compile@rt.cpan.org) [150317 18:48]: Show quoted text
> Tue Mar 17 14:48:41 2015: Request 102832 was acted upon. > Transaction: Ticket created by MJGARDNER > Queue: XML-Compile > Subject: decode error in XML::Compile::Translate::Reader when element with > > Using XML::Compile::WSDL11 in conjunction with the Avalara tax service at https://development.avalara.net/tax/taxsvc.wsdl (docs here: http://developer.avalara.com/api-reference).
Structurally, XML schema's are not flexible enough to detect and report problems correctly. When an element is reported to be incorrect, it usually is the one before (or earlier when there are optional elements). In your case, the schema says: ... <s:element minOccurs="1" maxOccurs="1" name="Tax" type="s:decimal" /> <s:element minOccurs="1" maxOccurs="1" name="TaxCalculated" type="s:decimal" /> <s:element minOccurs="0" maxOccurs="1" name="TaxDetails" type="tns:ArrayOfTaxDetail" /> <s:element minOccurs="1" maxOccurs="1" name="ExemptCertId" type="s:int" /> <s:element minOccurs="1" maxOccurs="1" name="TaxDate" type="s:date" /> <s:element minOccurs="1" maxOccurs="1" name="ReportingDate" type="s:date" /> <s:element minOccurs="1" maxOccurs="1" name="AccountingMethod" type="tns:AccountingMethod" /> <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" type="s:boolean" default="false" /> ... Your message shows ... <Tax>6.65</Tax> <TaxCalculated>6.65</TaxCalculated> <TaxIncluded>false</TaxIncluded> <TaxDetails> <TaxDetail>...</TaxDetail> </TaxDetails> <ExemptCertId>0</ExemptCertId> <TaxDate>2015-03-16</TaxDate> <ReportingDate>2015-03-16</ReportingDate> <AccountingMethod>Accrual</AccountingMethod> </TaxLine> If you look carefully, you see that the "TaxIncluded" element is incorrectly places. The WSDL does not match the provided service. -- Success, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
On Tue Mar 17 15:52:41 2015, Mark@Overmeer.net wrote: Show quoted text
> If you look carefully, you see that the "TaxIncluded" element is > incorrectly places. The WSDL does not match the provided service.
That's not true - as I read the schema "TaxIncluded" is part of "TaxLine", which is in "TaxLines" via "ArrayOfTaxLine", which is in "GetTaxResult", etc. Or am I reading it wrong? <s:complexType name="GetTaxResult"> <s:complexContent mixed="false"> <s:extension base="tns:BaseResult"> <s:sequence> [...] <s:element minOccurs="0" maxOccurs="1" name="TaxLines" type="tns:ArrayOfTaxLine" /> [...] <s:complexType name="ArrayOfTaxLine"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="TaxLine" nillable="true" type="tns:TaxLine" /> </s:sequence> </s:complexType> <s:complexType name="TaxLine"> <s:sequence> [...] <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" type="s:boolean" default="false" />
Subject: Re: [rt.cpan.org #102832] decode error in XML::Compile::Translate::Reader when element with value 0 follows subtree
Date: Tue, 17 Mar 2015 21:20:24 +0100
To: Mark Gardner via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <mark [...] nluug.nl>
* Mark Gardner via RT (bug-XML-Compile@rt.cpan.org) [150317 20:13]: Show quoted text
> Queue: XML-Compile > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102832 > > > That's not true -
Show quoted text
> as I read the schema "TaxIncluded" is part of > "TaxLine", which is in "TaxLines" via "ArrayOfTaxLine", which is in > "GetTaxResult", etc. Or am I reading it wrong?
True. Show quoted text
> <s:complexType name="TaxLine"> > <s:sequence>
That's the element which I quoted a part from. It contains a sequence of elements. Sequences is a forced ordering. Show quoted text
> <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" type="s:boolean" default="false" />
This element is optional at the end of the sequence. In the message you show me, it appears somewhere in the middle. That doesn't match. So, what part of my reasoning is not true? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
On Tue Mar 17 16:20:41 2015, mark@nluug.nl wrote: Show quoted text
> * Mark Gardner via RT (bug-XML-Compile@rt.cpan.org) [150317 20:13]:
> > Queue: XML-Compile > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102832 > > > > > That's not true -
>
> > as I read the schema "TaxIncluded" is part of > > "TaxLine", which is in "TaxLines" via "ArrayOfTaxLine", which is in > > "GetTaxResult", etc. Or am I reading it wrong?
> > True. >
> > <s:complexType name="TaxLine"> > > <s:sequence>
> > That's the element which I quoted a part from. It contains a sequence > of elements. Sequences is a forced ordering. >
> > <s:element minOccurs="0" maxOccurs="1" name="TaxIncluded" > > type="s:boolean" default="false" />
> > This element is optional at the end of the sequence. In the message > you show me, it appears somewhere in the middle. That doesn't match. > > So, what part of my reasoning is not true?
I'm sorry, I misunderstood you. I thought you meant that "TaxIncluded" was in the wrong part of the tree, not that it was wrongly sequenced. I'll report it as a problem to Avalara.
Subject: Re: [rt.cpan.org #102832] decode error in XML::Compile::Translate::Reader when element with value 0 follows subtree
Date: Thu, 19 Mar 2015 08:45:57 +0100
To: Mark Gardner via RT <bug-XML-Compile [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Mark Gardner via RT (bug-XML-Compile@rt.cpan.org) [150317 20:25]: Show quoted text
> Queue: XML-Compile > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=102832 >
On IRC you wrote (22:06:29) mjgardner: markov: Thanks for your help with RT#102832. It ended up being a "known issue" so I had to work around it with some hooks: http://mjg.ph/1Es11SG Wow. Impressive code. I think I would simply patch the WSDL. An other way to do it, is by loading a patch schema: if you load a second schema which defines the same top-level, that it will overrule the older. It is not unusual that schema's/wsdls are broken: many XML libraries ask people to manually create the elements. Of course, it's easy to make mistakes when there is no automated support. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net