A SOAP service implemented in Node.js that communicates with QuickBook's Web Connector.
The following steps should get you up and running.
There are a few prerequisites you should have on hand:
- Access to the desktop running Quickbooks and hosting the Company File.
- The Quickbooks Company's administrator (user:
admin
) password - Optional: A dedicated username and password for your web-service to interact with the Quickbooks Web Connector (it is not recommended to use the admin username and password!).
- Optional: The port on which the service should be available. Defaults to
8080
.
Set environment (env
) variables for the following values (these are the defaults):
QB_USERNAME=username
QB_PASSWORD=password
QB_COMPANY_FILE=C:\Users\Public\Documents\Intuit\QuickBooks\Sample Company Files\QuickBooks 2014\sample_wholesale-distribution business.qbw
QB_SOAP_PORT=8000
Depending on your environemnt, you may need to set QB_COMPNANY_FILE
in one of the following ways:
QB_COMPANY_FILE=C:\Users\Public\Documents\Intuit\QuickBooks\Sample Company Files\QuickBooks 2014\sample_wholesale-distribution business.qbw
QB_COMPANY_FILE='C:\Users\Public\Documents\Intuit\QuickBooks\Sample Company Files\QuickBooks 2014\sample_wholesale-distribution business.qbw'
QB_COMPANY_FILE=C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Sample Company Files\\QuickBooks 2014\\sample_wholesale-distribution business.qbw
QB_COMPANY_FILE='C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Sample Company Files\\QuickBooks 2014\\sample_wholesale-distribution business.qbw '
For easy env
variable management checkout the dotenv package.
You must addtionally create your own qbXMLHandler
that will send the SOAP Server a queue of requests to pass to QBWC. It will addtionally handle the qbXML responses and any errors that may be returned.
There is an example class here.
// Public
module.exports = {
/**
* Builds an array of qbXML commands
* to be run by QBWC.
*
* @param callback(err, requestArray)
*/
fetchRequests: function(callback) {
return callback(null, []);
},
/**
* Called when a qbXML response
* is returned from QBWC.
*
* @param response - qbXML response
*/
handleResponse: function(response) {
console.log(response);
},
/**
* Called when there is an error
* returned processing qbXML from QBWC.
*
* @param error - qbXML error response
*/
didReceiveError: function(error) {
console.log(error);
}
};
To start the service from the command line simply run:
node bin/run
To start the app from an Express install the package:
npm install quickbooks-js --save
Then start the service from your app.js
with:
var Server = require('quickbooks-js');
var qbXMLHandler = require('./qbXMLHandler');
var soapServer = new Server();
quickbooksServer.setQBXMLHandler(qbXMLHandler);
soapServer.run();
- Login to your Quickbooks Company with your
admin
user. - In the Quickbooks Web Connector, select "Add an Application" and supply it with a
.qwc
file. There is an example here.- You may need to use
0.0.0.0
or a local IP like10.0.0.156
to run locally <OwnerID>
and<FileID>
can be any randomguid
- You may need to use
- Quickbooks will prompt you to authorize your new web service.
- You may need to enter your password into QBWC once the app is added.
To start the service from the command line simply run:
node test/client.js
To start the app from an Express install the package:
npm install quickbooks-js --save
Then start the service from your app.js
with:
var quickbooks = require('quickbooks-js');
quickbooks.run();
Unit tests are written in mocha.
npm test
This project was forked from qbws
and originally written by @johnballantyne.
Modified by @MattMorgis at Rappid Development.