How to create a .qwc file for QuickBooks Web Connector?
Asked Answered
C

1

10

I am integrating QuickBooks (desktop version) with an ASP.NET application. For that I am using QuickBooks Web Connector. How can I create a .qwc file for my custom web service?

Cribbs answered 17/10, 2013 at 7:35 Comment(0)
V
27

The Web Connector is really just a proxy or a relay that sits between QuickBooks and your own application.

As an overview - basically, you build a SOAP server / Web Service which speaks a specific set of methods. The Web Connector then is installed on the machine running QuickBooks, and polls your web service asking “Hey, got anything for me to do?” Your web service can then respond with qbXML requests (examples of qbXML here) which tell the Web Connector “Add this customer: …” or “Send me invoices which match: …” or etc. etc. etc. The Web Connector then relays those requests to QuickBooks, QuickBooks processes them, and the response is relayed back to your web service. Your web service might then process the response somehow, and then send the next request over to the Web Connector.

There's a bigger overview of the Web Connector here or, if you download the QuickBooks SDK it has a 100+ page PDF that goes over this in detail.

You probably also want to look at this example after installing the QuickBooks SDK:

  • C:\Program Files (x86)\Intuit\IDN\QBSDK12.0\samples\qbdt\c-sharp\qbXML\WCWebService

Which is a complete working examples of a Web Connector SOAP implementation.

At it's most basic form, it looks something like this:

    [WebMethod]
    /// <summary>
    /// WebMethod - authenticate()
    /// To verify username and password for the web connector that is trying to connect
    /// Signature: public string[] authenticate(string strUserName, string strPassword)
    /// 
    /// IN: 
    /// string strUserName 
    /// string strPassword
    ///
    /// OUT: 
    /// string[] authReturn
    /// Possible values: 
    /// string[0] = ticket
    /// string[1]
    /// - empty string = use current company file
    /// - "none" = no further request/no further action required
    /// - "nvu" = not valid user
    /// - any other string value = use this company file
    /// </summary>
    public string[] authenticate(string strUserName, string strPassword)
    {
        string[] authReturn = new string[2];

        // Generate a random session ticket 
        authReturn[0]= System.Guid.NewGuid().ToString();

        // For simplicity of sample, a hardcoded username/password is used.
        string pwd="password";

        if (strUserName.Trim().Equals("username") && strPassword.Trim().Equals(pwd))
        {
            // An empty string for authReturn[1] means asking QBWebConnector 
            // to connect to the company file that is currently openned in QB
            authReturn[1]="";
        }
        else
        {
            authReturn[1]="nvu";
        }

        return authReturn;
    }

    [ WebMethod(Description="This web method facilitates web service to send request XML to QuickBooks via QBWebConnector",EnableSession=true) ]
    /// <summary>
    /// WebMethod - sendRequestXML()
    /// Signature: public string sendRequestXML(string ticket, string strHCPResponse, string strCompanyFileName, 
    /// string Country, int qbXMLMajorVers, int qbXMLMinorVers)
    /// 
    /// IN: 
    /// int qbXMLMajorVers
    /// int qbXMLMinorVers
    /// string ticket
    /// string strHCPResponse 
    /// string strCompanyFileName 
    /// string Country
    /// int qbXMLMajorVers
    /// int qbXMLMinorVers
    ///
    /// OUT:
    /// string request
    /// Possible values: 
    /// - “any_string” = Request XML for QBWebConnector to process
    /// - "" = No more request XML 
    /// </summary>
    public string sendRequestXML(string ticket, string strHCPResponse, string strCompanyFileName, 
        string qbXMLCountry, int qbXMLMajorVers, int qbXMLMinorVers)
    {
        // QuickBooks has asked for your next request

        ... return a qbXML request here ... 
    }

    [ WebMethod(Description="This web method facilitates web service to receive response XML from QuickBooks via QBWebConnector",EnableSession=true) ]
    /// <summary>
    /// WebMethod - receiveResponseXML()
    /// Signature: public int receiveResponseXML(string ticket, string response, string hresult, string message)
    /// 
    /// IN: 
    /// string ticket
    /// string response
    /// string hresult
    /// string message
    ///
    /// OUT: 
    /// int retVal
    /// Greater than zero  = There are more request to send
    /// 100 = Done. no more request to send
    /// Less than zero  = Custom Error codes
    /// </summary>
    public int receiveResponseXML(string ticket, string response, string hresult, string message)
    {
        // QuickBooks has sent you a qbXML response to your request 

        ... do something with 'response' here ... 
    }

That example also includes an example .QWC file. Here's some .QWC file documentation and here's a basic example:

<?xml version="1.0"?>
<QBWCXML>
    <AppName>QuickBooks Integrator</AppName>
    <AppID></AppID>
    <AppURL>https://secure.domain.com/quickbooks/server.php</AppURL>
    <AppDescription></AppDescription>
    <AppSupport>http://www.domain.com/quickbooks/support.php</AppSupport>
    <UserName>username</UserName>
    <OwnerID>{90A44FB7-33D9-4815-AC85-AC86A7E7D1EB}</OwnerID>
    <FileID>{57F3B9B6-86F1-4FCC-B1FF-967DE1813D20}</FileID>
    <QBType>QBFS</QBType>
    <Scheduler>
        <RunEveryNMinutes>2</RunEveryNMinutes>
    </Scheduler>
    <IsReadOnly>false</IsReadOnly>
</QBWCXML>
Villanueva answered 17/10, 2013 at 12:23 Comment(15)
Thanks for your answer. Now i have added the quickbooks app to Quickbook web connector. Now how can i get the quickbooks values to my asp.net application?Cribbs
Did you read any of the links or documentation that I posted above? Did you post your code so that we can see what you're doing? What request are you sending to QuickBooks? What is the response you're getting back? What does the log from the Web Connector say?Villanueva
Yes, i read the document and created .qwc file and downloaded the web-service from developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/… link. In web connector added a application using Add an application button and update the selected. Still every thing is fine. Then what i suppose to do?Cribbs
What are you TRYING to do? Add a customer? Query for invoices? Something else?Villanueva
I want to take the invoice details from the quickbook. How can i do that?. Is there is any example available to fetch invoice details?Cribbs
So you'd return a InvoiceQueryRq from your sendRequestXML method, and you'll get back a list of invoices in your receiveResponseXML method. Here's some example qbXML: consolibyte.com/docs/index.php/Example_qbXML_Requests and you can find more qbXML reference in the QuickBooks OSR: developer-static.intuit.com/qbSDK-current/Common/newOSR/…Villanueva
HI @Keith Palmer, can you please kindly provide me a new web service example for Quickbooks integration. Currently what i did was, just created the windows app and interacted with QB but what i need was, when i add the payment details in QB it should automatically insert in my db. How to do this?Cribbs
I don't have an example that does specifically that, but it should be trivial for you to extend the example I referred to above. You'd want to send a ReceivePaymentQuery request to query for payments, and then store the payment info you get back in the receiveResponseXML method.Villanueva
Hi Golda...do you got any solutions for how web service is get the specific values like customers and saving into our database.....if you any samples ...kindly provide me....Ibby
@KeithPalmerJr. I'm using QB Desktop but still I'm not sure from where I can get the AppID, OwnerID, FileID? Can you please confirm it's static guid or we get it from QB?Expunge
I've checked your reference site (wiki.consolibyte.com/wiki/doku.php/…) but still you've not mentioned from where we can get that details. If possible update your site for clarity would be good. What's DataExt elements mentioned in FileID?Expunge
@MayankModi In the .QWC file you can just invent the FileID, OwnerID, and the AppID is blank as shown in the example above. Just make them up.Villanueva
@KeithPalmerJr. So I need to use same .QWC file in your example without any changes and it'll make it up automatically? In fact not sure if we've to create .qwc file from anywhere or not?Expunge
Read the notes I posted in the original answer. YOU need to make up the values of the FileID and OwnerID. Yes, you need to create a .QWC file.Villanueva
@KeithPalmerJr. I've opened separate question regarding web connector sample #52609355 here. Can you please check it once? Thanks!Expunge

© 2022 - 2024 — McMap. All rights reserved.