如何为QuickBooks Web Connector创建.qwc文件? [英] How to create a .qwc file for QuickBooks Web Connector?

查看:94
本文介绍了如何为QuickBooks Web Connector创建.qwc文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将QuickBooks(台式机版本)与ASP.NET应用程序集成在一起.为此,我正在使用QuickBooks Web Connector.如何为自定义Web服务创建.qwc文件?

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?

推荐答案

Web连接器实际上只是位于QuickBooks和您自己的应用程序之间的代理或中继.

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

作为概述-基本上,您将构建一个讲一组特定方法的SOAP服务器/Web服务.然后,将Web连接器安装在运行QuickBooks的计算机上,并轮询您的Web服务,询问嘿,有什么事要做吗?"然后,您的Web服务可以使用qbXML请求(此处的qbXML示例)进行响应,该请求告诉Web连接器添加该客户:…"或向我发送匹配的发票:…"等,等等.等等.然后,Web连接器将这些请求中继到QuickBooks,QuickBooks处理它们,并将响应中继回您的Web服务.然后,您的Web服务可能会以某种方式处理响应,然后将下一个请求发送到Web连接器.

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.

这里有一个更大的 Web连接器概述,或者,如果您下载了QuickBooks SDK ,其中有100多页的PDF详细介绍了此内容.

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.

在安装QuickBooks SDK之后,您可能还想看一下此示例:

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

这是Web连接器SOAP实现的完整示例.

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

最基本的形式如下:

    [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 ... 
    }

该示例还包括示例.QWC文件. 这是一些.QWC文件文档,下面是一个基本示例:

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>

这篇关于如何为QuickBooks Web Connector创建.qwc文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆