问题
Am setting up a basic SOAP service to add dummy customers into QuickBooks. When I load the QWC file to the web connector, it runs and gives a message that No Data Exchange required and then it doesn't add any records to the QuickBooks Desktop Application.
This is my SOAP Server:
<?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;
}
This is my QWC File:
<?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>
This is the log I get:
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
My guess is that the issue could be here according to the logs:
<authRet[0]="3a923263-0a0e-56e4-7d2c-44245c30b9db"><authRet[1]="none"><authRet[2]=""><authRet[3]="">
However, am not able to really know what the problem is.
回答1:
I figured out the problems.
The company file path was wrong. I had it this way:
C:/Users/Public/Documents/Intuit/QuickBooks/Company%20Files/Filename.qbw
Instead of
C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\Filename.qbw
I was queueing in the wrong place. I was doing my queue inside
if (!QuickBooks_Utilities::initialized($dsn)){ ... }
This is wrong because this part runs only once. I had to queue immediately after I push something to QuickBooks.
来源:https://stackoverflow.com/questions/41722751/quickbooks-web-connector-application-not-adding-customers-to-quickbooks-desktop