Question

I've built a very simple XML request to QuickBooks Desktop and validated it with the QBSDK qb*XML Validator, which tells me the XML instance is valid:

<?qbxml version="12.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <CustomerAddRq requestID="12">
      <CustomerAdd>
        <Name>EDWARDS, JOHN</Name>
        <FirstName>John</FirstName>
      </CustomerAdd>
    </CustomerAddRq>
  </QBXMLMsgsRq>
</QBXML>

However, both my own C# app and the SDK-provided qbXML Test apps fail with the unhelpful message "QuickBooks found an error when parsing the provided XML text stream."

I've successfully authorized the app through QuickBooks, and gave it that extra customer information permission just to be sure.

According to the OSR, the only required field is "Name". I've run out of places to go with this investigation.

Is there anything obviously wrong with how I'm going about this? Is there a permissions issue I'm not seeing?

Was it helpful?

Solution

Got it! C#'s XDocument.ToString() drops the <?xml?> directive. My other query worked because I was using XmlDocument.InnerXml, which didn't do that (but looked uglier compared to XDocument). I went ahead and just concatenated:

doc.Declaration.ToString() + doc.ToString()

Basically the same problem as XDocument.ToString() drops XML Encoding Tag

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top