2013-10-17 32 views

回答

18

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

作为一个概述 - 基本上,您构建了一个SOAP服务器/ Web服务,它讲述了一组特定的方法。然后,Web连接器安装在运行QuickBooks的计算机上,并询问您的Web服务,询问“嘿,我有什么要做?”然后,您的Web服务可以响应qbXML请求(examples of qbXML here),告诉Web连接器“添加此客户:...“或”发送匹配的发票......“等.Web Connector然后将这些请求转发给QuickBooks,QuickBooks处理它们,并将响应转发回您的Web服务。您的Web服务可能会以某种方式处理响应,然后将下一个请求发送到Web连接器。

还有一个更大的overview of the Web Connector here或者,如果您下载QuickBooks SDK它有一个100页以上的PDF页面详细解释了这一点。

你可能也想看看下面这个例子安装QuickBooks的SDK后:

  • C:\ Program Files文件(x86)的\忒\ IDN \ QBSDK12.0 \样本\ qbdt \ C-锐\ qbXML \ WCWebService

这是Web连接器SOAP实现的完整工作示例。

在它的最基本的形式,它看起来是这样的:

[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文件。 Here's some .QWC file documentation这里有一个基本的例子:

<?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> 
+0

谢谢你的回答。现在我已将quickbooks应用添加到Quickbook Web连接器。现在我怎么能得到我的asp.net应用程序的quickbooks值? – Golda

+0

您是否阅读过我上面发布的任何链接或文档?你有没有发布你的代码,以便我们可以看到你在做什么?您向QuickBooks发送了什么请求?你回来的回应是什么? Web连接器的日志说什么? –

+0

是的,我阅读文档并创建了.qwc文件,并从https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0250_qb/0050_documentation/sample_code链接下载了Web服务。在Web连接器中使用添加应用程序按钮添加了一个应用程序并更新所选内容仍然每件事情都很好。那么我想要做什么? – Golda

相关问题