Reputation: 61
I am using PHP API for QuickBook WebConnector to Synchronize data between Sugar CRM and QuickBook Desktop. That is available on https://github.com/consolibyte/quickbooks-php.
My SOAP request code to update customer is below.
function _quickbooks_customer_update_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale) {
$arr = mysql_fetch_assoc(mysql_query("SELECT * FROM my_customer_table WHERE id = " . (int) $ID));
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
<CustomerModRq>
<CustomerMod>
<ListID>80000001-1409745864</ListID>
<EditSequence>1409745864</EditSequence>
<Name>' . $arr['name'] . '</Name>
<CompanyName>' . $arr['name'] . '</CompanyName>
<FirstName>' . $arr['fname'] . '</FirstName>
<LastName>' . $arr['lname'] . '</LastName>
</CustomerMod>
</CustomerModRq>
</QBXML>';
return $xml;
}
But when I click on Webconnector to update then it gives error. 0x80040400: QuickBooks found an error when parsing the provided XML text stream.
I miss some thing in that XML but I can't find it.
Please identify me and help me to write an Accurate XML to update customer in WebConnector
Upvotes: 0
Views: 190
Reputation: 2656
Also, you should look at using a newer QBXML version, so that you get the latest references.
Upvotes: 0
Reputation: 27962
You should refer to the QuickBooks OSR for qbXML reference. You can also use the XML Validator tool included with the QuickBooks SDK to validate these requests.
The particular problem with this request is that you're missing an XML node. The proper syntax is:
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
<!-- **Here is the XML tag you are missing** -->
<QBXMLMsgsRq onError="stopOnError">
<CustomerModRq>
<CustomerMod>
<ListID>80000001-1409745864</ListID>
<EditSequence>1409745864</EditSequence>
<Name>' . $arr['name'] . '</Name>
<CompanyName>' . $arr['name'] . '</CompanyName>
<FirstName>' . $arr['fname'] . '</FirstName>
<LastName>' . $arr['lname'] . '</LastName>
</CustomerMod>
</CustomerModRq>
</QBXMLMsgsRq>
</QBXML>
Upvotes: 1