I need to make a post request to a web service. The web service has the following structure:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:kn="http://..//soapAction">
<soap:Header/>
<soap:Body>
<kn:InsertOrders>
<!--Optional:-->
<kn:XmlOrders>?</kn:XmlOrders>
<kn:stringLength>?</kn:stringLength>
<!--Optional:-->
<kn:LoadListId>?</kn:LoadListId>
</kn:InsertOrders>
</soap:Body>
</soap:Envelope>
XmlOrders accepts a string and I'm trying to pass the following xml String in it:
<?xml version="1.0" encoding="utf-8"?> <EXAMPLE xmlns="EXAMPLE"> <HEADER> <ID>G112233</ID> <TR>AB123</TR> </HEADER> <HEADER> <ID>G123123</ID> <TR>AB1234</TR> </HEADER> <DETAIL> <DETAILID>123123123</DETAILID> <TXT>ATR_123</TXT> </DETAIL> <DETAIL> <DETAILID>123123123</DETAILID> <TXT>ATR_123</TXT> </DETAIL> </EXAMPLE>
However, SoapUI returns 400 bad request:
Wed May 16 12:41:19 EEST 2018:DEBUG:Receiving response: HTTP/1.1 400 Bad Request
Wed May 16 12:41:19 EEST 2018:DEBUG:Connection can be kept alive indefinitely
Does anyone have any idea about it?
I post this answer here because this is what solved my problem. I wrapped the XML String inside:
"<![CDATA[" + myXMLString + "]]>"
It actually parsed the XML String without encoding it,or escaping the characters > , < , & , ', ".
Yes, you could convert XML into String and set it into Method call.
Eventually, When XML gets converted into String
' is replaced with '
" is replaced with "
& is replaced with &
< is replaced with <
> is replaced with >
refer XML escaping for more details.
Your example XML will become--
<?xml version="1.0" encoding="utf-8"?> <EXAMPLE xmlns="EXAMPLE"> <HEADER> <ID>G112233</ID> <TR>AB123</TR> </HEADER> <HEADER> <ID>G123123</ID> <TR>AB1234</TR> </HEADER> <DETAIL> <DETAILID>123123123</DETAILID> <TXT>ATR_123</TXT> </DETAIL> <DETAIL> <DETAILID>123123123</DETAILID> <TXT>ATR_123</TXT> </DETAIL> </EXAMPLE>
Related
I have EWS soap request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrincipalName>room1#exch2010.local</t:PrincipalName>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:GetItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:Subject"></t:FieldURI>
<t:FieldURI FieldURI="calendar:Start"></t:FieldURI>
<t:FieldURI FieldURI="calendar:End"></t:FieldURI>
<t:FieldURI FieldURI="calendar:Location"></t:FieldURI>
<t:FieldURI FieldURI="calendar:Organizer"></t:FieldURI>
<t:FieldURI FieldURI="item:Body"></t:FieldURI>
<t:FieldURI FieldURI="item:TextBody"></t:FieldURI>
</t:AdditionalProperties>
</m:ItemShape>
<m:ItemIds>
<t:ItemId Id="AAAUAHJvb20xQGV4Y2gyMDEwLmxvY2FsAEYAAAAAALp73pDts6BGkBAHp2xunxIHAOLiLPCbqYNEl0bu9R23VJMAAAAW2OQAAOLiLPCbqYNEl0bu9R23VJMAAAAXKY8AAA==" ChangeKey="DwAAAA=="></t:ItemId>
</m:ItemIds>
</m:GetItem>
</soap:Body>
</soap:Envelope>
Response error is:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
<faultstring xml:lang="en-US">The request failed schema validation: The 'Traversal' attribute is not declared.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
<t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:LineNumber>16</t:LineNumber>
<t:LinePosition>20</t:LinePosition>
<t:Violation>The 'Traversal' attribute is not declared.</t:Violation>
</t:MessageXml>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Why would it fail?
Similar request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<soap:Header>
<t:ExchangeImpersonation>
<t:ConnectingSID>
<t:PrincipalName>room1#exch2010.local</t:PrincipalName>
</t:ConnectingSID>
</t:ExchangeImpersonation>
</soap:Header>
<soap:Body>
<m:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:Subject"></t:FieldURI>
<t:FieldURI FieldURI="calendar:Start"></t:FieldURI>
<t:FieldURI FieldURI="calendar:End"></t:FieldURI>
<t:FieldURI FieldURI="calendar:Location"></t:FieldURI>
</t:AdditionalProperties>
</m:ItemShape>
<m:CalendarView StartDate="2016-05-30T11:08:48" EndDate="2016-12-31T11:08:48"></m:CalendarView>
<m:ParentFolderIds>
<t:FolderId Id="AAAUAHJvb20xQGV4Y2gyMDEwLmxvY2FsAC4AAAAAALp73pDts6BGkBAHp2xunxIBAOLiLPCbqYNEl0bu9R23VJMAAAAW2OQAAA==" ChangeKey="AgAAABYAAADi4izwm6mDRJdG7vUdt1STAAAAFtkD"></t:FolderId>
</m:ParentFolderIds>
</m:FindItem>
</soap:Body>
</soap:Envelope>
works perfectly
EDIT 1:
I have removed traversal attribute and than got error:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode
xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation
</faultcode>
<faultstring xml:lang="en-US">The request failed schema validation: The 'FieldURI' attribute is invalid - The value 'item:TextBody' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</faultstring>
<detail>
<e:ResponseCode
xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation
</e:ResponseCode>
<e:Message
xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.
</e:Message>
<t:MessageXml
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:LineNumber>3</t:LineNumber>
<t:LinePosition>649</t:LinePosition>
<t:Violation>The 'FieldURI' attribute is invalid - The value 'item:TextBody' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</t:Violation>
</t:MessageXml>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
Then I removed last Additional property
<t:FieldURI FieldURI="item:TextBody"></t:FieldURI>
and finally got this error.
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="123" MinorBuildNumber="3" Version="Exchange2010_SP2"
xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</s:Header>
<s:Body
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:GetItemResponse
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Error">
<m:MessageText>The EWS Id is in EwsLegacyId format which is not supported by the Exchange version specified by your request. Please use the ConvertId method to convert from EwsLegacyId to EwsId format.</m:MessageText>
<m:ResponseCode>ErrorInvalidIdMalformedEwsLegacyIdFormat</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:Items/>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</s:Body>
</s:Envelope>
Please advise.
There is no traversal attribute in the GetItem element you can check the reference documentation https://msdn.microsoft.com/en-us/library/aa563775(v=exchg.150).aspx
Traversals are only valid in FindItem and FindFolder operations (its specifies what scope of Folders you are searching). GetItem is just getting a particular Item you have the Id for (The Id contains the information to locate the Item so any folder/mailbox context isn't needed). That said if you don't have rights to the particular Item and you try to use GetItem the error reported will be that the Item doesn't exist in the store (which is a little deceiving).
Edit 1
You need to start versioning all the EWS Requests you make eg in the Header
<soap:Header>
<t:RequestServerVersion Version="Exchange2010_SP2" />
</soap:Header>
You need to put the schema version https://msdn.microsoft.com/en-us/library/office/dn741586(v=exchg.150).aspx you working with (or at least put Exchange2007_SP1) . That will address the EWSId error (you won't be able to use the Id your trying to use but you should get the correct ID from the other request you got that from).
How can I parse the SOAP response xml using Spring Batch. Creating bean for org.springframework.batch.item.xml.StaxEventItemReader and passring fragmentRootElementName parameter value as XMLData returned nothing, probably unmarshalling issue.
SOAP XML
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<WSCorIDSOAPHeader xmlns="http://www.wilytech.com/" CorID="5A35F9B79906411A00156F9B91FFE1EB,1:1,0,0,wl-flor-apvm106|Tomcat|dorms106-1|WebServices|Client|http_//tempuri.org/|submit,2,AgAAAdRIQgAAAAFGAAAAAQAAABFqYXZhLnV0aWwuSGFzaE1hcAAAAAdIQgAAAAJGAAAAAgAAABBqYXZhLmxhbmcuU3RyaW5nABBBcHBNYXBDYWxsZXJUeXBlSEIAAAADRQAAAAIACldlYlNlcnZpY2VIQgAAAARFAAAAAgARQXBwTWFwQ2FsbGVyQWdlbnRIQgAAAAVFAAAAAgAKZG9ybXMxMDYtMUhCAAAABkUAAAACAA9DYWxsZXJUaW1lc3RhbXBIQgAAAAdFAAAAAgANMTQ1NzUwNzQwMDExOUhCAAAACEUAAAACABZBcHBNYXBDYWxsZXJNZXRob2ROYW1lSEIAAAAJRQAAAAIAGmh0dHBfLy90ZW1wdXJpLm9yZy98c3VibWl0SEIAAAAKRQAAAAIAEEFwcE1hcENhbGxlckhvc3RIQgAAAAtFAAAAAgAPd2wtZmxvci1hcHZtMTA2SEIAAAAMRQAAAAIAE0FwcE1hcENhbGxlclByb2Nlc3NIQgAAAA1FAAAAAgAGVG9tY2F0SEIAAAAORQAAAAIAClR4blRyYWNlSWRIQgAAAA9FAAAAAgAjNUEyRDkxRjE5OTA2NDExQTAwMTU2RjlCRTAyOEIwNUM5ODU=" />
<To soap:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://fldcvpswa0806.something.com/RTPTransaction/SubmitTransaction.svc?wsdl</To>
<Action soap:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/ISubmitTransaction/Submit</Action>
</soap:Header>
<soap:Body>
<ns2:Submit xmlns="http://schemas.datacontract.org/2004/07/RTPTransaction" xmlns:ns2="http://tempuri.org/" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/">
<ns2:XMLData>
<Creation>2016-03-09 02:10:00</Creation>
<EndOfDays />
<Transactions>
<Transaction>
<BusinessDate>2016-03-09</BusinessDate>
<Items>
<Item>
<Extended>35.0</Extended>
<Number>480000015523</Number>
<Quantity>1</Quantity>
<Taxes>
<Tax>
<Amount>0.00</Amount>
<Rate>0.000</Rate>
<State>FL</State>
<Type>N</Type>
</Tax>
</Taxes>
<Unit>35.0</Unit>
</Item>
</Items>
<Stamp>2016-03-09 00:00:00</Stamp>
<Store>01006</Store>
</Transaction>
</Transactions>
</ns2:XMLData>
</ns2:Submit>
</soap:Body>
</soap:Envelope>
The following code was working a few weeks ago but now I get an error message. Any ideas? Note this is QuickBooks Online United Kingdom edition.
I'm adding additional information here so that I can save the form. Without adding this additional information I am unable to post this question.
<outgoing><?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://schema.intuit.com/finance/v3">
<CustomerId>1</CustomerId>
<CustomerRef>1</CustomerRef>
<SalesTermRef>3</SalesTermRef>
<DocNumber>101</DocNumber>
<CustomerMemo>Thank you for your order!</CustomerMemo>
<TxnDate>2014-03-05</TxnDate>
<PrivateNote>Special Handling</PrivateNote>
<BillEmail>
<Address>janice#johnson.com</Address>
</BillEmail>
<PrintStatus>NotSet</PrintStatus>
<EmailStatus>NeedToSend</EmailStatus>
<ApplyTaxAfterDiscount></ApplyTaxAfterDiscount>
<ShipDate>2014-03-05</ShipDate>
<TrackingNum>1Z9999W99999999999</TrackingNum>
<BillAddr>
<Line1>110 Main Street</Line1>
<Line2>Suite 2000</Line2>
<Line3></Line3>
<Line4></Line4>
<City>Dallas</City>
<CountrySubDivisionCode>TX</CountrySubDivisionCode>
<PostalCode>99875</PostalCode>
<Country></Country>
</BillAddr>
<ShipAddr>
<Line1>110 Main Street</Line1>
<Line2>Suite 2000</Line2>
<Line3></Line3>
<Line4></Line4>
<City>Dallas</City>
<CountrySubDivisionCode>TX</CountrySubDivisionCode>
<PostalCode>99875</PostalCode>
<Country></Country>
</ShipAddr>
<Line>
<Description>Blue MP3 Player</Description>
<Amount>110.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>3</ItemRef>
<Qty>2</Qty>
<UnitPrice>55</UnitPrice>
<TaxCodeRef>3</TaxCodeRef>
</SalesItemLineDetail>
</Line>
<Line>
<Description></Description>
<Amount></Amount>
<DetailType>DiscountLineDetail</DetailType>
<DiscountLineDetail>
<PercentBased>true</PercentBased>
<DiscountPercent>0.0200</DiscountPercent>
</DiscountLineDetail>
</Line>
<Line>
<Description></Description>
<Amount>12.00</Amount>
<DetailType>SalesItemLineDetail</DetailType>
<SalesItemLineDetail>
<ItemRef>SHIPPING_ITEM_ID</ItemRef>
<Qty></Qty>
<UnitPrice></UnitPrice>
<TaxCodeRef>3</TaxCodeRef>
</SalesItemLineDetail>
</Line>
</Invoice>
</outgoing>
<returns><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-04-17T11:42:01.411-07:00">
<Fault type="ValidationFault">
<Error code="6440" element="">
<Message>Transaction Detail Information Required</Message>
<Detail>You must select a product/service or an account for each split line with either an amount or a billable customer.</Detail>
</Error>
</Fault>
</IntuitResponse>
</returns>
Found the answer. In QBO preferences I had to enable shipping.
Trying to get a journal entry to save in QBO UK using TaxCodeRef but keep getting the same error message back. I have set the TaxApplicableOn correctly. I did a query of a manually entered journal entry and it shows the element TaxAmount however I don't know this value at runtime. How can I get a journal entry to save when setting a TaxCodeRef?
Here's my XML request and response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<outgoing><?xml version="1.0" encoding="UTF-8"?>
<JournalEntry xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://schema.intuit.com/finance/v3">
<TxnDate>2014-03-05</TxnDate>
<PrivateNote>Invoice</PrivateNote>
<DocNumber>102</DocNumber>
<Adjustment>false</Adjustment>
<Line>
<Desc>Credit Sales</Desc>
<Amount>150</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Credit</PostingType>
<AccountRef>1</AccountRef>
<ClassRef></ClassRef>
<DepartmentRef></DepartmentRef>
<BillableStatus></BillableStatus>
<TaxCodeRef>3</TaxCodeRef>
<TaxApplicableOn>Credit</TaxApplicableOn>
</JournalEntryLineDetail>
</Line>
<Line>
<Desc>Debit Accounts Receivable</Desc>
<Amount>150.00</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Debit</PostingType>
<Entity>
<Type>Customer</Type>
<EntityRef>21</EntityRef>
</Entity>
<AccountRef>52</AccountRef>
<ClassRef></ClassRef>
<DepartmentRef></DepartmentRef>
<BillableStatus></BillableStatus>
<TaxCodeRef>3</TaxCodeRef>
<TaxApplicableOn>Debit</TaxApplicableOn>
</JournalEntryLineDetail>
</Line>
</JournalEntry>
</outgoing>
<returns><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-03-17T07:21:39.545-07:00">
<Fault type="ValidationFault">
<Error code="2270" element="TaxApplicableOn">
<Message>TaxApplicableon missing or invalid</Message>
<Detail>TaxApplicableOn null is required and valid values are Credit or Debit</Detail>
</Error>
<Error code="2270" element="TaxApplicableOn">
<Message>TaxApplicableon missing or invalid</Message>
<Detail>TaxApplicableOn null is required and valid values are Credit or Debit</Detail>
</Error>
</Fault>
</IntuitResponse>
</returns>
I created a Journal Entry from QBO UI and selected Sales Check box on the line item.
Here is the response.
Looks like the error message is wrong. Valid value is Sales or Purchase(if Sales box is not selected). Let me get some more details around this.
<JournalEntry domain="QBO" sparse="false">
<Id>29</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2014-03-17T22:29:18-07:00</CreateTime>
<LastUpdatedTime>2014-03-17T22:29:18-07:00</LastUpdatedTime>
</MetaData>
<DocNumber>DocNu2</DocNumber>
<TxnDate>2014-03-18</TxnDate>
<CurrencyRef name="British Pound Sterling">GBP</CurrencyRef>
<ExchangeRate>1</ExchangeRate>
<Line>
<Id>0</Id>
<Description>ff</Description>
<Amount>24.00</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Debit</PostingType>
<Entity>
<Type>Customer</Type>
<EntityRef name="toto">1</EntityRef>
</Entity>
<AccountRef name="Debtors">50</AccountRef>
<TaxCodeRef>3</TaxCodeRef>
<TaxApplicableOn>Sales</TaxApplicableOn>
<TaxAmount>4.80</TaxAmount>
</JournalEntryLineDetail>
</Line>
<Line>
<Id>1</Id>
<Description>ff</Description>
<Amount>28.80</Amount>
<DetailType>JournalEntryLineDetail</DetailType>
<JournalEntryLineDetail>
<PostingType>Credit</PostingType>
<Entity>
<Type>Customer</Type>
<EntityRef name="toto">1</EntityRef>
</Entity>
<AccountRef name="Savings">59</AccountRef>
<TaxCodeRef>9</TaxCodeRef>
<TaxApplicableOn>Sales</TaxApplicableOn>
<TaxAmount>0.00</TaxAmount>
</JournalEntryLineDetail>
</Line>
<TxnTaxDetail>
<TaxLine>
<Amount>4.80</Amount>
<DetailType>TaxLineDetail</DetailType>
<TaxLineDetail>
<TaxRateRef>4</TaxRateRef>
<PercentBased>true</PercentBased>
<TaxPercent>20</TaxPercent>
<NetAmountTaxable>24.00</NetAmountTaxable>
</TaxLineDetail>
</TaxLine>
<TaxLine>
<Amount>0</Amount>
<DetailType>TaxLineDetail</DetailType>
<TaxLineDetail>
<TaxRateRef>15</TaxRateRef>
<PercentBased>true</PercentBased>
<TaxPercent>0</TaxPercent>
<NetAmountTaxable>-28.80</NetAmountTaxable>
</TaxLineDetail>
</TaxLine>
</TxnTaxDetail>
<Adjustment>false</Adjustment>
</JournalEntry>
I see that the docs here-
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/journalentry
mention that it is a type of TaxApplicableOnEnum which has valid values as sales or purchase.
We are using the Intuit API V2 to import Invoices from QuickBooks Online.
We expect the "TotalAmt" field to be present on all the invoices.
There are a couple of invoices that at one point in the past had the "TotalAmt" present but now the "TotalAmt" field is missing and the "Balance" is equal to 0.
Is this a bug or expected behavior?
Edit: this is one of the responses we got from the QuickBooks API (I changed only the indentation and replaced real data with 3 dots):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo" xmlns:qbp="http://www.intuit. com/sb/cdm/qbopayroll/v1">
<Id idDomain="QBO">36673</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreateTime>2013-04-10T15:24:03-07:00</CreateTime>
<LastUpdatedTime>2013-04-11T08:32:11-07:00</LastUpdatedTime>
</MetaData>
<Header>
<DocNumber>...</DocNumber>
<TxnDate>2013-04-10-07:00</TxnDate>
<Note>...</Note>
<CustomerId idDomain="QBO">464</CustomerId>
<ToBePrinted>true</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<SalesTermId idDomain="QBO">1</SalesTermId>
<DueDate>2013-04-10-07:00</DueDate>
<BillAddr>
<Line1>...</Line1>
<City>...</City>
<CountrySubDivisionCode>...</CountrySubDivisionCode>
<PostalCode>...</PostalCode>
<Tag>CUSTOMER</Tag>
</BillAddr>
<ShipAddr>
<Line1>...</Line1>
<City>...</City>
<CountrySubDivisionCode>...</CountrySubDivisionCode>
<PostalCode>...</PostalCode>
<Tag>CUSTOMER</Tag>
</ShipAddr>
<ShipMethodId idDomain="QBO"/>
<Balance>0.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>...</Desc>
<Taxable>false</Taxable>
<ItemId idDomain="QBO">5</ItemId>
<UnitPrice>450</UnitPrice>
<Qty>1</Qty>
</Line>
</Invoice>
<Balance>0.00</Balance>
It indicates the amount associated with that invoice is 0. In this case, response XML doesn't include any "TotalAmt" field.
There can be couple of cases where 'TotalAmt' doesn't get included.
1.
I had created an invoice with amount as 0. PFB that invoice record in QBO and the corresponding response XML.
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">50</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-07-01T01:59:37-07:00</CreateTime>
<LastUpdatedTime>2013-07-01T01:59:37-07:00</LastUpdatedTime>
</MetaData>
<Header>
<DocNumber>1016</DocNumber>
<TxnDate>2013-07-01-07:00</TxnDate>
<CustomerId idDomain="QBO">6</CustomerId>
<ToBePrinted>false</ToBePrinted>
<ToBeEmailed>true</ToBeEmailed>
<SalesTermId idDomain="QBO">3</SalesTermId>
<DueDate>2013-07-31-07:00</DueDate>
<BillAddr>
<Line1>Park Avenue NY</Line1>
...
</BillAddr>
<ShipAddr>
<Line1>Park Avenue NY</Line1>
...
</ShipAddr>
<BillEmail>john_doe#digitalinsight.mint.com</BillEmail>
<ShipMethodId idDomain="QBO" />
<Balance>0.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Beer HB</Desc>
<Taxable>true</Taxable>
<ItemId idDomain="QBO">4</ItemId>
</Line>
</Invoice>
2.
If you don't pass any value in the 'Amount' field of tag
or
If you skip that field altogether.
PFB sample request and response.
Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:ns2="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:ns3="http://www.intuit.com/sb/cdm/qbo">
<Header>
<Msg>Testing</Msg>
<CustomerId>6</CustomerId>
</Header>
<Line>
<Desc>Pens</Desc>
<Amount></Amount>
<Taxable>true</Taxable>
<ItemId>3</ItemId>
<UnitPrice>450</UnitPrice>
<Qty>1</Qty>
</Line>
</Invoice>
Response
<Invoice xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:qbp="http://www.intuit.com/sb/cdm/qbopayroll/v1" xmlns:qbo="http://www.intuit.com/sb/cdm/qbo">
<Id idDomain="QBO">57</Id>
<SyncToken>0</SyncToken>
<MetaData>
<CreateTime>2013-07-01T02:48:48-07:00</CreateTime>
<LastUpdatedTime>2013-07-01T02:48:48-07:00</LastUpdatedTime>
</MetaData>
<Header>
<DocNumber>1022</DocNumber>
<TxnDate>2013-07-01-07:00</TxnDate>
<Msg>Testing</Msg>
<CustomerId idDomain="QBO">6</CustomerId>
<ToBePrinted>false</ToBePrinted>
<ToBeEmailed>false</ToBeEmailed>
<DueDate>2013-07-01-07:00</DueDate>
<BillAddr>
<Line1>Park Avenue NY</Line1>
...
</BillAddr>
<ShipAddr>
<Line1>Park Avenue NY</Line1>
...
</ShipAddr>
<ShipMethodId idDomain="QBO" />
<Balance>0.00</Balance>
<DiscountTaxable>true</DiscountTaxable>
</Header>
<Line>
<Desc>Pens</Desc>
<Taxable>true</Taxable>
<ItemId idDomain="QBO">3</ItemId>
<UnitPrice>450</UnitPrice>
<Qty>1</Qty>
</Line>
</Invoice>
I guess, the second one is applicable in your case.
Please let me know if it answers your qts.
Thanks
It looks like the Amount in the Line is not being set. The Amount is a required field that needs to be set. Here is the doc: https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0400_quickbooks_online/invoice
The total amount field will be calculated
thanks
Jarred