QuickBooks Integrator 2020 iOS Edition

Questions / Feedback?

QBWCServer Class

Properties   Methods   Events   Configuration Settings   Errors  

The QBWCServer class is used to communicate with QuickBooks Web Connector from your application.

Syntax

InQBQBWCServer
InQBQBWCServerSwift

Remarks

The QBWCServer class is designed to process requests from QuickBooks Web Connector and fire events that allow you to provide information to, and get information from QuickBooks Web Connector.

This allows you to create an application that can communicate with a remote copy of QuickBooks without worrying about directly accessing the machine where QuickBooks is running. For more information on the design of this approach refer to the Intuit website for QuickBooks Web Connector.

QWC Files

The first step in establishing a relationship between your application and a remote instance of QuickBooks is to create a QWC file. This file specifies information about your application its requirements, as well as the access you need. The CreateQWCFile method creates the QWC file which must be generated for each user of your application. The minimum required properties are:

Once the file is generated the end user will obtain the file from your website, and you will assign a password for that user at that time. The password is not part of the QWC file but the user will provide this directly in QuickBooks Web Connector and it will be sent to your web application during the connection for verification purposes.

Request Processing

The class is designed with a server environment in mind. That is, it's typical that the class will be used in a web page, but is not required. However the HTTP request is received, it can be passed to the RequestData property. After passing the request data to the class call ProcessRequest method processes the request from QuickBooks Web Connector. Processing the requests will fire one of the events.

The class provides various events to interact with QuickBooks Web Connector. QuickBooks Web Connector will make a sequence of calls for any given session, and the events correspond to these calls. Within the events you control the response which dictates what QuickBooks Web Connector will do next.

A session ticket is provided so you can keep track of a particular session over the course of multiple calls. An example of a typical session:

  1. ServerVersion fires. This allows you to provide an the version of your application. This is purely informational and does not need to be implemented.
  2. ClientVersion fires. This provides version information about the QuickBooks Web Connector. It may be used to reject a connection based on minimum required versions, but in most cases no action would be taken in your code and the session proceeds.
  3. Authenticate fires. This event allows verification of the user that is connecting. Here you will either accept or reject the connection.
  4. SendRequest fires. Within this event you will supply a QBXML request that will be passed to QuickBooks.
  5. ReceiveResponse fires. QuickBooks Web Connector returns the QBXML response from the request you gave it in the previous step, or error information about why the request failed.
  6. CloseConnection fires. This is the last event in the session. You may provide a message that will be displayed in QuickBooks Web Connector, but in most cases you would not take any action in this event.

Preparing Requests and Parsing Responses

The SendRequest event requires that you provide a QBXML request. This can be generated using the other components in this toolkit. To do so, simply set the QBRequestMode property to rmOffline before making a method call. For instance:

Customer customer = new Customer();
customer.QBRequestMode = CustomerQBRequestModes.rmOffline;
customer.GetByName("John Doe");
e.Request = customer.QBRequestAggregate;
In the above code the class is used in the same way you would use the class if you were communicating directly with QuickBooks with the exception that QBRequestMode is set to rmOffline. When the GetByName method is called instead of attempting to communicate with QuickBooks only the QBRequestAggregate property is populated. This QBXML aggregate should be passed to the e.Request parameter inside the SendRequest event.

Processing responses is similar. You will receive the QBXML response from the e.Response parameter inside the ReceiveResponse event. You may then pass the response to the QBResponseAggregate property, or InputQBXML method of other components in the toolkit. For instance:

Customer customer = new Customer();
customer.QBResponseAggregate = e.Response;
string myAccountNumber = customer.AccountNumber;
Setting QBResponseAggregate and calling InputQBXML do the exact same thing. The class parses the response and populates the properties of the class.

Error Handling

There are two basic types of errors when dealing with QuickBooks Web Connector. The first are errors that originate from your application and are reported to QuickBooks Web Connector. These are driven by the actions you take inside events. For instance in the SendRequest event you may set e.Request to empty string to signify an error. QuickBooks Web Connector will see this and make another call and GetLastError will fire. GetLastError is fired when QuickBooks Web Connector is asking from error information from your application. Here you may provide details about the error.

The second type of error is a communication error between QuickBooks Web Connector and QuickBooks itself. When this happens QuickBooks Web Connector will make a call and ConnectionError will fire with information about the error received from QuickBooks.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

- overwriteWhether to overwrite QWC files.
- QWCFileInfoAppDescriptionA brief description of the application.
- QWCFileInfoAppDisplayNameThe display name of the application.
- QWCFileInfoAppIdThe application Id.
- QWCFileInfoAppNameThe name of the application.
- QWCFileInfoAppSupportURLA URL where users can find support for your product.
- QWCFileInfoAppUniqueNameIf this property is set the QuickBooks Web Connector will not use its clone/replace model for the AppName and will instead use the replace routine.
- QWCFileInfoAppURLThe URL of your web application.
- QWCFileInfoAuthFlagsThis property specifies which versions of QuickBooks your application supports.
- QWCFileInfoCertURLThis property specifies a URL which is used by the QuickBooks Web Connector to obtain and validate the SSL certificate.
- QWCFileInfoFileIdThis property specifies a unique Id.
- QWCFileInfoIsReadOnlySpecifies whether read or read/write access is needed.
- QWCFileInfoNotifyDetermines if notification are allowed.
- QWCFileInfoOwnerIdThis property specifies an Id which identifies your application.
- QWCFileInfoPersonalDataPrefThis property defines the type of access to personal/sensitive data required by your application.
- QWCFileInfoUnattendedModePrefThis property specifies whether you need to access QuickBooks in unattended mode (when QuickBooks is closed).
- QWCFileInfoUpdateIntervalThis property specifies the desired update interval in seconds.
- QWCFileInfoUserThis property species the user.
- requestDataThe request data to process.
- responseDataThe response data.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

- configSets or retrieves a configuration setting.
- createQWCFileCreates a QWC file.
- processRequestProcesses the request.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

- onAuthenticateFired when the QuickBooks Web Connector authenticates.
- onClientVersionProvides the QuickBooks Web Connector version information.
- onCloseConnectionFires when the update session completes.
- onConnectionErrorFires when QuickBooks Web Connector is unable to connect to QuickBooks.
- onErrorInformation about errors during data delivery.
- onGetInteractiveURLFires when the URL for an interactive session is needed.
- onGetLastErrorFires when QuickBooks Web Connector checks for error information.
- onInteractiveDoneThis event fires when QuickBooks Web Connector checks to see if the interactive session is finished.
- onInteractiveRejectedThis event fires after a user rejects an interactive session.
- onReceiveResponseFires when a response is received.
- onSendRequestFires when QuickBooks Web Connector asks for a request.
- onServerVersionFires when QuickBooks Web Connector requests the version of your application.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

QBTypeThe type of QuickBooks software the connection will be made to.
StyleSpecifies the SOAP encoding style used in requests made by QuickBooks Web Connector.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 /n software inc. - All rights reserved.
QuickBooks Integrator 2020 iOS Edition - Version 20.0 [Build 7941]