QUICKBOOKS_ADD_CUSTOMER函数不会触发(“无数据交换”)


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

我正在尝试将我的OpenCart与QB桌面同步。但它不起作用。QB Web 连接器显示"无数据交换"。

这是我的代码:

// 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;
}

这是我的测试句柄.php对新客户排队的代码:

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!');
}

它会向数据库添加新记录:

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

网络连接器日志:

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

我在_quickbooks_customer_add_request中添加了一个die(),但它忽略了此功能。

有谁知道如何解决这个问题?谢谢。

只要您收到"无需数据交换",这意味着队列中没有任何内容可供 Web 连接器处理,或者您有严重配置错误的内容。

由于quickbooks_queue表中确实有记录,因此我的第一个猜测是 Web 连接器以与队列表中不同的用户身份进行连接。

您能否确认 .您使用的QWC文件使用此用户名?

someuser

除此之外,您有一些配置错误的东西。根据您的日志,您似乎配置错误。具体说来:

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

这应该是指向您的 QuickBooks 公司文件的文件路径(在 QuickBooks 中按 F2 查看它(,或者它应该为空。该值绝对不是有效的 Windows 文件路径。

另外,这个:

qwbc_min_run_every_n_seconds: 60

删除此内容。你也不应该有这个集合,除非你有一个很好的、非常具体的理由这样做。它与多个版本的 Web 连接器不兼容。

您是否遵循了快速入门指南?如果你有,你不会遇到这些问题...

  • https://github.com/consolibyte/quickbooks-php