Reputation: 1669
I have QuickBooks 2010 pro edition, As the Title suggests I need to import Products & Invoices into Quickbooks.
Some Background...
we are an online company where we sell products online, my client wants to import all products into quickbooks and every online sale into quickbooks as well, our website is built using ASP.NET with SQL Server as backed.
I am new to quickbooks, so i am not sure what to do from here...
I have heard of IIF import & SDK, unfortunately I could not find and valuable documentation on them. can anyone please put me in right direction (maybe some sample code)? please do not give me SDK url of quickbooks website.
Thanks
Upvotes: 0
Views: 5045
Reputation: 27982
If you're not willing to look at the QuickBooks SDK, you are doing yourself a huge disservice.
The easiest way to implement what you're trying to do is via the SDK and the Web Connector. There's a basic overview of the QuickBooks Web Connector on our wiki. It's specifically geared towards moving data from an online website, into QuickBooks for Windows (just like you're trying to do). The basic idea is that it polls your website, asking for stuff to do, and you can feed it XML requests to do stuff (add a customer, add an invoice, etc.).
Basic protocol looks like this:
// Web Connector asks your SOAP service to authenticate Web Connector => SOAP server: authenticate with the username "xyz" and the password "bla" (authenticate) If authentication is successful, the SOAP server returns a ticket value and the process continues
// Web Connector asks for something to do Web Connector => SOAP server: hey SOAP server, what do you have for me to do? (sendRequestXML) SOAP server generates and returns a qbXML request
// Web Connector relays that request to QuickBooks, and receives a response from QuickBooks Web Connector => QuickBooks: hey QuickBooks, the SOAP server gave me this request, can you please process it? QuickBooks processes the request, and returns a response to the Web Connector
// Web Connector relays the response from QuickBooks back to the SOAP server Web Connector => SOAP server: hey SOAP server, here is the response for that last request from QuickBooks (receiveResponseXML) SOAP server processes the response, handling any errors and doing whatever with the response SOAP server returns a percentage done, if it's less than 100%, this process continues...
// The process starts over, with the Web Connector asking the SOAP server for the next request... Web Connector => SOAP server: hey SOAP server, what else do you have for me to do? (sendRequestXML) SOAP server generates and returns a qbXML request
... and so on and so forth ...
If you download the QuickBooks SDK (ouch, sorry!) you'll find that it contains some of the stuff you've asked for. Specifically, there is sample code it drops in this directory:
C:\Program Files (x86)\Intuit\IDN\QBSDK12.0\samples\qbdt\c-sharp\qbXML\WCWebService
Here's a cleaned up, stripped down version of what's in that sample code:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.IO;
using System.Security.Cryptography;
using Microsoft.Win32;
using System.Xml;
using System.Text.RegularExpressions;
namespace WCWebService
{
/// <summary>
/// Web Service Namespace="http://developer.intuit.com/"
/// Web Service Name="WCWebService"
/// Web Service Description="Sample WebService in ASP.NET to
/// demonstrate QuickBooks WebConnector"
/// </summary>
[WebService(
Namespace="http://developer.intuit.com/",
Name="WCWebService",
Description="Sample WebService in ASP.NET to demonstrate " +
"QuickBooks WebConnector")]
// Important Note:
// You should keep the namespace as http://developer.intuit.com/ for all web
// services that communicates with QuickBooks Web Connector.
public class WCWebService : System.Web.Services.WebService
{
...
#region WebMethods
[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];
// Code below uses a random GUID to use as session ticket
// An example of a GUID is {85B41BEE-5CD9-427a-A61B-83964F1EB426}
authReturn[0]= System.Guid.NewGuid().ToString();
// For simplicity of sample, a hardcoded username/password is used.
// In real world, you should handle authentication in using a standard way.
// For example, you could validate the username/password against an LDAP
// or a directory server
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";
}
// You could also return "none" to indicate there is no work to do
// or a company filename in the format C:\full\path\to\company.qbw
// based on your program logic and requirements.
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)
{
... build some qbXML request here and return it ...
return request;
}
[ 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)
{
... process the response from QuickBooks here, and return an integer ...
return retVal;
}
#endregion
} // class: WCWebService
} // namespace: WCWebService
The QuickBooks SDK also contains a 98 page Web Connector documentation PDF which describes implementation in detail, and 600 pages of general QuickBooks SDK documentation which might be helpful.
Upvotes: 6