Serhii Matrunchyk
Serhii Matrunchyk

Reputation: 9363

QUICKBOOKS_ADD_CUSTOMER function doesn't trigger (“no data exchange”)

I'm trying to synchronize my OpenCart with QB Desktop. But it doesn't work. QB Web Connector says "no data exchange".

Here is my code:

// Map QuickBooks actions to handler functions
$map = array(
    QUICKBOOKS_ADD_CUSTOMER => array( '_quickbooks_customer_add_request', '_quickbooks_customer_add_response' ),
);

$errmap = array(
    '*' => '_quickbooks_error_catchall',
);

$hooks = array();

$log_level = QUICKBOOKS_LOG_DEVELOP;

$soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN
$soap_options = array();

$handler_options = array(
    'deny_concurrent_logins' => false,
    'deny_reallyfast_logins' => false,
);      // See the comments in the QuickBooks/Server/Handlers.php file

$driver_options = array(        // See the comments in the QuickBooks/Driver/<YOUR DRIVER HERE>.php file ( i.e. 'Mysql.php', etc. )
    'max_log_history' => 32000, // Limit the number of quickbooks_log entries  to 1024
    'max_queue_history' => 1024,    // Limit the number of *successfully processed* quickbooks_queue entries to 64
);

$callback_options = array();

// Set up our queue singleton
QuickBooks_WebConnector_Queue_Singleton::initialize($dsn);

$Server = new QuickBooks_WebConnector_Server($dsn, $map, $errmap, $hooks, $log_level, $soapserver, QUICKBOOKS_WSDL, $soap_options, $handler_options, $driver_options, $callback_options);
$response = $Server->handle(true, true);

function _quickbooks_customer_add_request($requestID, $user, $action, $ID,  $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
// Grab the data from our MySQL database
$arr = array(
    'name' => 'opencart' . date('ymdhis'),
    'fname' => 'opencart'. date('ymdhis'),
    'lname' => 'opencart'. date('ymdhis'),
);

$xml = '<?xml version="1.0" encoding="utf-8"?>
    <?qbxml version="2.0"?>
    <QBXML>
        <QBXMLMsgsRq onError="stopOnError">
            <CustomerAddRq requestID="' . $requestID . '">
                <CustomerAdd>
                    <Name>' . $arr['name'] . '</Name>
                    <CompanyName>' . $arr['name'] . '</CompanyName>
                    <FirstName>' . $arr['fname'] . '</FirstName>
                    <LastName>' . $arr['lname'] . '</LastName>
                </CustomerAdd>
            </CustomerAddRq>
        </QBXMLMsgsRq>
    </QBXML>';

return $xml;
}

Here is my test handle.php code which queue a new customer:

if (isset($_GET['customer_id']))
{
    $id = intval($_GET['customer_id']);

    // Queue up the customer add

    $Queue = new QuickBooks_WebConnector_Queue($dsn);
    $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $id);

    die('Great, queued up a customer!');
}

It adds a new record to the database:

quickbooks_queue_id = 609
quickbooks_ticket_id = null
qb_username = someuser
qb_action = CustomerAdd
ident = 123456
extra = empty
qbxml = empty
priority = 0
qb_status = q
enqueue_datetime = 2016-02-02 20:58:50
dequeue_datetime = null

Web Connector log:

20160204.06:45:32 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'QuickBooks Bridge for OpenCart' has STARTED
20160204.06:45:32 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20160204.06:45:32 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20160204.06:45:32 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: QuickBooks Bridge for OpenCart
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): QuickBooks Bridge for OpenCart
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: https://example.com/qbwc.php
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="PHP QuickBooks SOAP Server v3.0 at /wce/qbwc.php">
20160204.06:45:32 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.34">
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'QuickBooks Bridge for OpenCart', username = 'someuser'
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="someuser"><password=<MaskedForSecurity>
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.updateWS() : Received from authenticate() following parameters:<authRet[0]="1c44d47f-1542-1854-3d22-0d9569718c76"><authRet[1]="13355f1b-4b26-4a7b-b182-15c6dd1246f9"><authRet[2]="1"><authRet[3]="">
20160204.06:45:33 UTC   : QBWebConnector.RegistryManager.setCurrentWebServiceName() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\CurrentWebServiceName has been set to QuickBooks Bridge for OpenCart
20160204.06:45:33 UTC   : QBWebConnector.RegistryManager.setCurrentWebServiceSessionTicket() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\CurrentWebServiceSessionTicket has been set to 1c44d47f-1542-1854-3d22-0d9569718c76
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.CheckCFNResponse() : User authenticated.
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.HandleDelayRequest() : Update has been postponed at 2/3/2016 10:45:33 PM by 'QuickBooks Bridge for OpenCart' for next 60 seconds
20160204.06:45:33 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Done.
20160204.06:45:33 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20160204.06:45:33 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20160204.06:45:33 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : No data to exchange for the application:  QuickBooks Bridge for OpenCart

I've added a die() to the _quickbooks_customer_add_request but it ignores this function.

Does any know how to solve this? Thank you.

Upvotes: 1

Views: 287

Answers (1)

Keith Palmer Jr.
Keith Palmer Jr.

Reputation: 27952

Anytime you get "No data exchange required." it means there's nothing in the queue for the Web Connector to process, or you have something badly misconfigured.

Since you do have records in the quickbooks_queue table, my first guess would be that the Web Connector is connecting as a different user than what's in the queue table.

Can you confirm that the .QWC file you used uses this username?

someuser

Short of that, you have something misconfigured. Based on your logs, it looks like you have something misconfigured. Specifically:

qb_company_file: 13355f1b-4b26-4a7b-b182-15c6dd1246f9;

This should be a file path pointing to your QuickBooks company file (hit F2 in QuickBooks to see it) or it should be empty. That value is definitely not a valid Windows file path.

Also, this:

qwbc_min_run_every_n_seconds: 60

Remove this. You should not have this set either unless you have a very good, very specific reason for doing so. It is incompatible with several versions of the Web Connector.

Did you follow the quick-start guide? You would not run into these issues if you had...

Upvotes: 1

Related Questions