5

The idea is to implement a QBWC web service using Node.js which can serve multiple incoming requests in an asynchronous fashion. Currently I am looking into qbws which is a Node.js web service for QuickBooks Desktop Web Connector. Any ideas on how I can extend this to support an asynchronous architecture for the service methods?
Thanks in Advance!

newbie
  • 663
  • 2
  • 6
  • 19
  • It's on my wishlist to modify qbws to use asynchronous callbacks for each method, but I don't currently have a suitable testing environment to make sure it's working properly. I've been working on resolving that, but for now you'll need to modify it to suit your needs. It shouldn't be that difficult though; just feel free to open up an issue on GitHub if you get stuck somewhere. – JohnB Sep 30 '15 at 16:23
  • @JohnB would you have some demo code on how the qbws work? – WABBIT0111 Dec 08 '15 at 02:41
  • @WABBIT0111 the code on GitHub is functional, check the [Usage section](https://github.com/johnballantyne/qbws#usage). If you have any questions about it, feel free to open up an issue on GitHub. – JohnB Dec 08 '15 at 15:53

1 Answers1

4

The soap module supports asynchronous function calls which makes this easy to do. To use the same template as my other answer, here's how you'd do that:

var soap = require('soap');

var yourService = {
    QBWebConnectorSvc: {
        QBWebConnectorSvcSoap: {
            serverVersion: function (args, callback) {

                // serverVersion code here

                callback({
                    serverVersionResult: { string: retVal }
                });
            },
            clientVersion: function (args, callback) {

                //clientVersion code here

                callback({
                    clientVersionResult: { string: retVal }
                });
            },

            // and all other service functions required by QBWC

        }
    }
};

There are two differences:

  1. Each method signature has an additional callback parameter
  2. There is no return, that's handled by callback() instead.

I don't currently have a suitable environment to test this, but I created a client to imitate QuickBooks Web Connector and it worked fine. Converting the qbws methods to asynchronous allowed it to service multiple clients simultaneously (including one legitimate QBWC client).

Community
  • 1
  • 1
JohnB
  • 1,231
  • 1
  • 18
  • 33
  • This is awesome!..tested with multiple actual QBWC clients.. working fine with the asynchronous calls to other servers..Thanks a tonne! – newbie Sep 30 '15 at 18:25
  • 2
    @newbie: Do you have an example code in github or open source that i can take a look? i am also developing a similar app to integrate with QuickBooks Desktop. – WABBIT0111 Dec 08 '15 at 00:17
  • @newbie if you have this code snippet on Github , then provide the link so that we will have a look, I'm also working on the same thing. – Code_Crash Oct 26 '16 at 20:14