Bobby Dawson Bobby Dawson - 4 months ago 42
PHP Question

Using consolibyte QuickBooks PHP framework - cannot import all employees 0x80040400 error

I must be missing something, because I have had no issue with querying all vendors, customers, and items, but employees are giving me a headache. My file is never making it to the import response, because it is throwing an 0x80040400 error of an error when parsing the provided xml text stream. This is the exact xml stream:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<EmployeeQueryRq iterator="Start" requestID="249">
<MaxReturned>10</MaxReturned>
<ActiveStatus>All</ActiveStatus>
<FromModifiedDate>1983-01-02T12:01:01</FromModifiedDate>
<OwnerID>0</OwnerID>
</EmployeeQueryRq>
</QBXMLMsgsRq>
</QBXML>


And this is the code that produced it (I'm using an iterator based on one of their examples to break up the return into batches - I used the exact same format on each section I am importing - it works for all other objects)

function _quickbooks_employee_import_request($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
// Iterator support (break the result set into small chunks)
$attr_iteratorID = '';
$attr_iterator = ' iterator="Start" ';
if (empty($extra['iteratorID']))
{
// This is the first request in a new batch
$last = _quickbooks_get_last_run($user, $action);
_quickbooks_set_last_run($user, $action);
// Update the last run time to NOW()
// Set the current run to $last
_quickbooks_set_current_run($user, $action, $last);
}
else
{
// This is a continuation of a batch
$attr_iteratorID = ' iteratorID="' . $extra['iteratorID'] . '" ';
$attr_iterator = ' iterator="Continue" ';

$last = _quickbooks_get_current_run($user, $action);
}

// Build the request
$xml = '<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="' . $version . '"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<EmployeeQueryRq ' . $attr_iterator . ' ' . $attr_iteratorID . ' requestID="' . $requestID . '">
<MaxReturned>' . QB_QUICKBOOKS_MAX_RETURNED . '</MaxReturned>
<ActiveStatus>All</ActiveStatus>
<FromModifiedDate>' . $last . '</FromModifiedDate>
<OwnerID>0</OwnerID>
</EmployeeQueryRq>
</QBXMLMsgsRq>
</QBXML>';

QuickBooks_Utilities::log(QB_QUICKBOOKS_DSN, $xml);
return $xml;
}


HELP!

Answer

Please refer to the documentation:

Which indicates that iterators are not supported for Employees.

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<EmployeeQueryRq metaData="ENUMTYPE">

If you continue to have trouble, please post the actual error message shown in the logs/Web Connector. Copy/paste.

This is not an error that QuickBooks produces:

0x80040400 error of an error when parsing the provided xml text stream

What you're probably seeing is:

QuickBooks found an error when parsing the provided XML text stream