0

I am trying to add a vendor bill to quickbooks using QBFC in C#. My issue is that if I want to define a custom address for this particular vendor (for just this particular bill), it throws an error saying

QuickBooks found an error when parsing the provided XML text stream

My test code is as follows:

 IBillAdd billAddRq = this.mainRequestMsgSet.AppendBillAddRq();

 billAddRq.VendorRef.FullName.SetValue(vendBill.transaction.Name);
 billAddRq.TxnDate.SetValue(Convert.ToDateTime(vendBill.transaction.Date));
 billAddRq.RefNumber.SetValue(vendBill.transaction.DocNum);
 billAddRq.VendorAddress.Addr1.SetValue("test");
 billAddRq.VendorAddress.Addr2.SetValue("test");
 billAddRq.VendorAddress.Addr3.SetValue("test");
 billAddRq.VendorAddress.Addr4.SetValue("test");
 billAddRq.VendorAddress.Addr5.SetValue("test");

The code works, however, if I get rid of all of the calls to VendorAddress and just leave it like this:

 IBillAdd billAddRq = this.mainRequestMsgSet.AppendBillAddRq();

 billAddRq.VendorRef.FullName.SetValue(vendBill.transaction.Name);
 billAddRq.TxnDate.SetValue(Convert.ToDateTime(vendBill.transaction.Date));
 billAddRq.RefNumber.SetValue(vendBill.transaction.DocNum);

Is there something special I need to do in order to define a custom vendor address for this vendors particular bill?

Giardino
  • 1,367
  • 3
  • 10
  • 30
  • You should check the StatusCode and StatusMessage of the QuickBooks response object. That will give you a detailed error message of what is causing the issue. Check all the properties of the Exception too. – Jon Jul 03 '14 at 17:55
  • I can't actually get the status code because my ResponseMsgSet.ResponseList is null after this request since the error interrupts the request. – Giardino Jul 03 '14 at 18:01
  • Have you tried just adding Addr1, and not 5 addresses? – Jon Jul 03 '14 at 19:02

1 Answers1

0

You haven't really provided enough information to solve this problem (QuickBooks year/version, the rest of your code, etc.) so I'm just going to throw out a wild guess here...

The VendorAddress node of the BillAdd request isn't supported until QuickBooks 2014 and newer. So, if you're using a version of QuickBooks 2013 or older... you can't use those nodes.

Additionally, the QuickBooks API versions themselves are versioned, so if you're specifying to use any version of qbXML less than 13.0, you can't use those nodes.

Since you didn't post what version of QuickBooks you're using or what version of qbXML you're specifying in the rest of your code, it's hard to know for sure whether that's the problem or not...

Keith Palmer Jr.
  • 27,666
  • 16
  • 68
  • 105