Reputation: 9
I have been using [quickbooks-php][1]
library by the Consolibyte
. I wanted to log in the Customer Query Result in a file named CustomerQuery.txt
but the messages I am getting as follows-
Version:
Not provided by service
Message:
No data exchange required
Description:
No data to exchange for this application. Job ending.
and here is the PHP code-
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
require_once('config.php');
require_once($QuickBooksFile);
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set('America/New_York');
}
$map = array(
QUICKBOOKS_QUERY_CUSTOMER => array( '_quickbooks_customer_query_request', '_quickbooks_customer_query_response' ),
);
$errmap = array();
$hooks = array();
$log_level = QUICKBOOKS_LOG_DEVELOP;
$soap = QUICKBOOKS_SOAPSERVER_BUILTIN;
$soap_options = array();
$handler_options = array(
'authenticate' => '_quickbooks_custom_auth',
'deny_concurrent_logins' => false,
);
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_QUERY_CUSTOMER, $primary_key_of_your_customer);
}
$Server = new QuickBooks_WebConnector_Server($DSN, $map, $errmap, $hooks, $log_level, $soap, QUICKBOOKS_WSDL, $soap_options, $handler_options);
$response = $Server->handle(true, true);
function _quickbooks_custom_auth($Username, $Password, &$QuickBooksCompanyFile){
return true;
}
function _quickbooks_customer_query_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="13.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CustomerQueryRq requestID="1">
<FullName>Kaley Baker</FullName>
<OwnerID>0</OwnerID>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
}
function _quickbooks_customer_query_response($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents)
{
file_put_contents('CustomerQuery.txt', $xml);
}
The config.php
file contents are as follows-
$UserName='Admin';
$Password='Test123';
$DSN='mysqli://root@localhost/qb';
$QuickBooksCompanyFile = 'E:\QB.QBW';
$QuickBooksFile='C:\xampp\htdocs\accounting\qb\QuickBooks.php';
$Email='[email protected]';
$DBHost='localhost';
$DBUser='root';
$DBPass='';
$DBName='qb';
*/
Upvotes: 0
Views: 436
Reputation: 27962
A quick Google or StackOverflow search yields the following link (together with a sea of other posts saying the same thing):
Which says:
What does "No data exchange required" mean?
That message means exactly what it says:
There's no data to exchange. There's nothing to do. The Web Connector (and most frameworks/dev kits built around it) use a 'queue' concept. Once the queue is empty, there's nothing else to do, and you'll get that message. If you add something to the queue, then it will process those items until there's nothing left to do, and then you'll get the "No Data Exchange..." message again.
So, for instance, say you want to build a process whereby every time a customer is created within your store, the customer gets created in QuickBooks. You'd then want to set up a process where when that customer is created within your store, you queue up a request to add the customer to QuickBooks.
Looking at your code, there is only one call to any sort of queue
method:
$Queue->enqueue(QUICKBOOKS_QUERY_CUSTOMER, $primary_key_of_your_customer);
And if you go back to the docs/examples where you found this code:
From this library:
You'll see the big comment that says:
// IMPORTANT NOTE: This particular example of queueing something up will
// only ever happen *once* when these scripts are first run/used. After
// this initial test, you MUST do your queueing in another script. DO NOT
// DO YOUR OWN QUEUEING IN THIS FILE! See
// docs/example_web_connector_queueing.php for more details and examples
// of queueing things up.
Sooooo...
quickbooks_queue
SQL table) look like?Example:
Upvotes: 1