问题
I am new to Quickbooks but I have already installed and have an account on Quickbook Premier Desktop Edition along with the Quickbook connector in place. I am trying to sync up the Invoices, Estimates and Customer information from my custom application into Quickbooks via the Quickbook connector that is available. The thing is, the SOAP xml response returned by my application is not accepted by the Quickbook connector as they might differ in format, So i wanted to create a service gateway for this using nodejs preferably wherein this middle tier can process and convert the SOAP according to the format that Quickbook connector accepts. There is a limitation that i cannot directly change the format in which my app is generating the SOAP response. So can anybody suggest where to start and if at all I am thinking in the right direction. Thanks in advance!
回答1:
Using the soap package, structure your service like so:
var soap = require('soap');
var yourService = {
QBWebConnectorSvc: {
QBWebConnectorSvcSoap: {
serverVersion: function (args) {
// serverVersion code here
return {
serverVersionResult: { string: retVal }
};
},
clientVersion: function (args) {
//clientVersion code here
return {
clientVersionResult: { string: retVal }
};
},
// and all other service functions required by QBWC
}
}
};
var soapServer = soap.listen(server, '/path-to-your-wsdl', yourService, xml);
Here's a sample response for clientVersion()
should look like using that structure:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://developer.intuit.com/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<soap:Body>
<tns:clientVersionResponse xmlns:tns="http://developer.intuit.com/" xmlns="http://developer.intuit.com/">
<tns:clientVersionResult>
<tns:string></tns:string>
</tns:clientVersionResult>
</tns:clientVersionResponse>
</soap:Body>
</soap:Envelope>
I've written a functional implementation, it's available here.
来源:https://stackoverflow.com/questions/32255742/quickbookdesktop-api-integration-using-quickbook-connector-and-nodejs