Home
Server Core
qbXML.class
Login
|
The NuSOAP server for the Prima Supply Updater consists of six functions that interface
with the QuickBooks Web Connector. The standard flow for a single update session is listed
below along with the prototypes of the server's methods. The code is temporarily available
here, but this will be prettied up later at a new site.
Preliminary steps:
- The user downloads and installs the .qwc file the points to our web service (PSU).
- Web Connector (WC) establishes the server as a valid web service and makes updates possible.
- The user enters the password (username supplied in the .qwc file) and hits update.
- Thus begins the application loop:
- WC calls PSU's authenticate method to initiate the process.
- PSU returns the session's ticket along with the result of authentication.
- A successful authentication returns the company file to use (or a blank string
for the default file).
- An unsuccessful authentication returns nvu. Upon receiving this message,
WC calls PSU's closeConnection method and ends the update.
- WC opens the QuickBooks file, gathers some settings data, and sends that to the web
service through sendRequestXML. It then waits for a response.
- (PSU here should parse and store the data received in HCPResponse. If this is the first
call, PSU should also store in the database this update session's information for the
duration of the update process.)
- Based on what's in PSU's action queue, it sends a qbXML request for QuickBooks as the
return value of sendRequestXML. An empty return string indicates an error.
- WC passes this request onto QuickBooks and awaits its response. The response is sent
to PSU's receiveResponseXML method as a qbXML message in $response. If an
error occurred, it will be indicated in $hresult and $message.
- PSU processes the response and returns an integer indicating the percentage of completion
for the current update process.
- A negative value indicates an error occurred. This will cause WC to call the
getLastError method and display the appropriate message to the user.
- A positive value less than 100 indicates there is more work to do. WC will
update its status bar and call sendRequestXML again, ommitting HCPResponse.
- The loop between sendRequestXML and receiveResponseXML continues
until an error occurs or the return value is 100, indicating completion.
- When the update is complete, WC calls closeConnection to indicate it is done
with the session. This returns a final status message.
- PSU should clean up the database and remove the appropriate entries from the tables.
Server methods:
- authenticate ($username, $password)
- sendRequestXML ($ticket, $HCPResponse, $CompanyFileName, $qbXMLCountry,
$qbXMLMajorVers, $qbXMLMinorVers)
- receiveResponseXML ($ticket, $response, $hresult, $message)
- getLastError ($ticket)
- closeConnection ($ticket)
- connectionError ($ticket, $hresult, $message)
Developed by wombats. Do it for the kids.
|