QuickBooks Web Connector应用程序未将客户添加到QuickBooks Desktop专业版

时间:2017-01-18 15:04:32

标签: php soap quickbooks

设置基本SOAP服务以将虚拟客户添加到QuickBooks中。 当我将QWC文件加载到Web连接器时,它会运行并显示无需数据交换的消息,然后它不会向QuickBooks桌面应用程序添加任何记录。

这是我的SOAP服务器:

<?php

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

if (function_exists('date_default_timezone_set'))
{
    date_default_timezone_set('Africa/Nairobi');
}

require_once '../../QuickBooks.php';

$user = 'mutie';
$pass = 'mutie';

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


$log_level = QUICKBOOKS_LOG_DEVELOP;

$soapserver = QUICKBOOKS_SOAPSERVER_BUILTIN;

$handler_options = array(
    'deny_concurrent_logins' => false, 
    'deny_reallyfast_logins' => false, 
    );  


$dsn = 'mysqli://mutie:mutie@localhost/quickbooksserver'

if (!QuickBooks_Utilities::initialized($dsn))
{   
    QuickBooks_Utilities::initialize($dsn);

    QuickBooks_Utilities::createUser($dsn, $user, $pass);   

    $primary_key_of_your_customer = 5;

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

    $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)
{        
    $xml = '<?xml version="1.0" encoding="utf-8"?>
        <?qbxml version="2.0"?>
        <QBXML>
            <QBXMLMsgsRq onError="stopOnError">
                <CustomerAddRq requestID="' . $requestID . '">
                    <CustomerAdd>
                        <Name>CCC, LLC (' . mt_rand() . ')</Name>
                        <CompanyName>CCC, LLC</CompanyName>
                        <FirstName>XXX</FirstName>
                        <LastName>XXX</LastName>
                        <BillAddress>
                            <Addr1>CCC, LLC</Addr1>
                            <Addr2>134 Stonemill Road</Addr2>
                            <City>Mansfield</City>
                            <State>CT</State>
                            <PostalCode>06268</PostalCode>
                            <Country>Kenya</Country>
                        </BillAddress>
                        <Phone>860-634-1602</Phone>
                        <AltPhone>860-429-0021</AltPhone>
                        <Fax>860-429-5183</Fax>
                        <Email>myemail@myemail.com</Email>
                        <Contact>XXX XXX</Contact>
                    </CustomerAdd>
                </CustomerAddRq>
            </QBXMLMsgsRq>
        </QBXML>';

    return $xml;
}

这是我的QWC文件:

<?xml version="1.0"?>
<QBWCXML>
    <AppName>My QuickBooks SOAP Server</AppName>
    <AppID></AppID>
    <AppURL>http://localhost/quickbooks/docs/web_connector/web_connector.php</AppURL>
    <AppDescription>An example QuickBooks SOAP Server</AppDescription>
    <AppSupport>http://localhost/quickbooks/docs/help.php</AppSupport>
    <UserName>mutie</UserName>
    <OwnerID>{57F3B9B6-86F1-4FCC-B1FF-166DE1813D20}</OwnerID>
    <FileID>{57F3B9B6-86F1-4FCC-B1FF-966DE1813D20}</FileID>
    <QBType>QBFS</QBType>
    <Notify>false</Notify>
    <Scheduler>
        <RunEveryNMinutes>10</RunEveryNMinutes>
    </Scheduler>
    <IsReadOnly>false</IsReadOnly>
</QBWCXML>

这是我得到的日志:

20170118.14:58:18 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : updateWS() for application = 'My QuickBooks SOAP Server' has STARTED
20170118.14:58:18 UTC   : QBWebConnector.RegistryManager.getUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock = FALSE
20170118.14:58:18 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to True
20170118.14:58:18 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session locked *********************
20170118.14:58:18 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : Initiated connection to the following application.
20170118.14:58:18 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppName: My QuickBooks SOAP Server
20170118.14:58:18 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppUniqueName (if available): My QuickBooks SOAP Server
20170118.14:58:18 UTC   : QBWebConnector.SOAPWebService.instantiateWebService() : AppURL: http://localhost/quickbooks/docs/web_connector/web_connector.php
20170118.14:58:18 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : *** Calling serverVersion().
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_serverVersion() : Received from serverVersion() following parameter:<serverVersionRet="PHP QuickBooks SOAP Server v3.0 at /quickbooks/docs/web_connector/web_connector.php">
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : *** Calling clientVersion() with following parameter:<productVersion="2.2.0.71">
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : Received from clientVersion() following parameter:<clientVersionRet="">
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_clientVersion() : This application agrees with the current version of QBWebConnector. Allowing update operation.
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Authenticating to application 'My QuickBooks SOAP Server', username = 'mutie'
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : *** Calling authenticate() with following parameters:<userName="mutie"><password=<MaskedForSecurity>
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.updateWS() : Received from authenticate() following parameters:<authRet[0]="3a923263-0a0e-56e4-7d2c-44245c30b9db"><authRet[1]="none"><authRet[2]=""><authRet[3]="">
20170118.14:58:19 UTC   : QBWebConnector.RegistryManager.setCurrentWebServiceName() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\CurrentWebServiceName has been set to My QuickBooks SOAP Server
20170118.14:58:19 UTC   : QBWebConnector.RegistryManager.setCurrentWebServiceSessionTicket() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\CurrentWebServiceSessionTicket has been set to 3a923263-0a0e-56e4-7d2c-44245c30b9db
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.CheckCFNResponse() : No data to exchange for this application. Job ending.
20170118.14:58:19 UTC   : QBWebConnector.SOAPWebService.do_authenticate() : Done.
20170118.14:58:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : HKEY_CURRENT_USER\Software\Intuit\QBWebConnector\UpdateLock has been set to False
20170118.14:58:19 UTC   : QBWebConnector.RegistryManager.setUpdateLock() : ********************* Update session unlocked *********************
20170118.14:58:19 UTC   : QBWebConnector.WebServiceManager.DoUpdateSelected() : No data to exchange for the application:  My QuickBooks SOAP Server

我的猜测是问题可能在这里根据日志:

<authRet[0]="3a923263-0a0e-56e4-7d2c-44245c30b9db"><authRet[1]="none"><authRet[2]=""><authRet[3]="">

然而,我无法真正知道问题所在。

1 个答案:

答案 0 :(得分:0)

我发现了问题。

  1. 公司档案路径错误。 我这样做了:

    C:/Users/Public/Documents/Intuit/QuickBooks/Company%20Files/Filename.qbw

  2. 而不是

    C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\Filename.qbw
    
    1. 我在错误的地方排队。 我在里面排队

      if (!QuickBooks_Utilities::initialized($dsn)){ ... }

    2. 这是错误的,因为这部分只运行一次。 我把东西推到QuickBooks后,我不得不立即排队。