|
| 1. | Add the ObjAcct API .Net assemblies to your Visual Studio .Net project. |
| • | ObjAcct.Framework.Webservices.dll |
| • | ObjAcct.Framework.Webservices.DataSets.dll |
| 2. | Reference the ObjAcct.Framework in your code. |
Visual Basic
Imports ObjAcct.Framework
C#
Using ObjAcct.Framework;
Namespaces
| • | ObjAcct.Framework.WebServices.DataSets - XML dataSets for all web services. |
| • | ObjAcct.Framework.Library.CloneLib - Functions that facilitate moving data between two different companies. |
| • | ObjAcct.Framework.Library.ReportLib - Functions related to the report engine. |
| • | ObjAcct.Framework.Library.SoapHeaderLib - Functions to set the SOAP header values. |
| • | ObjAcct.Framework.Library.SqlLib - Functions for running SQL using Enterprise Services. |
| • | ObjAcct.Framework.Library.StdLib - General functions that facilitate use of the API. |
| • | ObjAcct.Framework.Library.WebLib - General functions that faciliate ASP.Net web form development. |
| • | ObjAcct.Framework.WebServices - Functions to read and write all ObjAcct tables. Compiled web service proxy classes generated from WSDL.exe. |
| 3. | To access accounting data using the ObjAcct Framework API, you must provide a valid CompanyID, UserID and Password or a valid LoginKey. These credentials are passed on the SOAP header of each call to the API. See: How to Login. |
All accounting Documents and Entities are saved and retrieved from the ObjAcct database using the ObjAcct Framework API. All data is saved and returned in DataSets. (See: DataSets, RowIDs, ReturnTypes)
Each class in the API has similar functions for saving and retrieving data:
Standard functions in Entity Classes
| • | DeleteEntity() - Deletes an Entity. |
| • | GetDropdownList() - Returns a DataSet formatted for use in a DropdownList. |
| • | GetEntityByEntityID() - Returns a DataSet containing an Entity retrieved by its EntityID. |
| • | GetEntityByRowID() - Returns a DataSet containing an Entity retrieved by its RowID. |
| • | GetFirstEntity() - Returns a DataSet containing the first Entity in alphabetic order by EntityID. |
| • | GetLastEntity() - Returns a DataSet containing the last Entity in alphabetic order by EntityID. |
| • | GetList() - Returns a DataSet containing all Entities. |
| • | GetNextEntity() - Returns a DataSet containing the next Entity in alphabetic order by EntityID relative to a passed EntityID. Useful for navigating through Entities in applications with a UI. |
| • | GetPriorEntity() - Returns a DataSet containing the prior Entity in alphabetic order by EntityID relative to a passed EntityID. Useful for navigating through Entities in applications with a UI. |
| • | SaveEntity() - Saves an existing Entity or creates a new Entity from a passed DataSet. |
Standard functions in Document Classes
| • | DeleteDocument() - Deletes a Document. |
| • | GetDocumentByDocumentID() - Returns a DataSet containing a Document retrieved by its DocumentID. |
| • | GetDocumentByRowID() - Returns a DataSet containing a Document retrieved by its RowID. |
| • | GetFindList() - Returns a DataSet containing a list of Documents that can be displayed in a UI to assist users in locating a Document. |
| • | GetFirstEntity() - Returns a DataSet containing the first Document. |
| • | GetLastEntity() - Returns a DataSet containing the last Document. |
| • | GetNextEntity() - Returns a DataSet containing the next Document relative to a passed DocumentID. Useful for navigating through Documents in applications with a UI. |
| • | GetPriorEntity() - Returns a DataSet containing the prior Document in alphabetic order by DocumentID relative to a passed DocumentID. Useful for navigating through Documents in applications with a UI. |
| • | SaveDocument() - Saves and existing Document or creates a new Document from a passed DataSet. |
Example - Login
' Get an instance of the LoginWebService.
Dim ws As New WebServices.LoginWebService()
Dim _loginKey As String
Dim ds As DataSet
' Get a loginKey from the web service.
ds = ws.GetLoginKey("demo", "smith", "abc123", _
"", "", "", "", "", "", ReturnType.Standard)
' Check for errors and invalid logins.
If StdLib.GetErrorNumber(ds) < 0 Then
MsgBox(StdLib.GetErrorMessage(ds))
Else
' Store the LoginKey in a variable.
loginKey = ds.Tables("Login").Rows(0).Item("LoginKey")
End If
Example - Access and Save Data
' Get an instance of the web services and set the LoginKey.
Dim ws As New WebServices.CustomerWebService()
StdLib.PopulateObjAcctSoapHeader(ws, Session("LoginKey"))
Dim ds As New DataSet()
' Retrieve the first Customer record.
ds = ws.GetFirstEntity(ReturnType.Standard)
' Change the Customer ID to a new value.
ds.tables("Entity").rows(0).items("CustomerID") = "Smith"
' Save the record back to the webservice.
Dim returnDs As DataSet = ws.SaveEntity(ds)
' Check for errors
If StdLib.GetErrorNumber(returnDs) < 0 Then
MsgBox(StdLib.GetErrorMessage(returnDs))
End If
|