Visual Studio 2010 Example
Install certificate
Surf to https://services.omnitracs.com/portalWeb/jsp/login.jsp using IE. Click the "lock" (security report) next to the address bar, then click "view certificates". Click "install certificate" and follow the wizard.
Create a project
Start Microsoft Visual Studio 2010 and generate a new WPF Application Project. For this example we will be creating a simple application that calls getCounts in Vehicle Management and displays the returned data.
Adding or Updating the Service Reference
Right click the References folder in the Solution Explorer and select "Add Service Reference". Then add the address of the WSDL you wish to reference and click "Go". Change the Namespace, then click "Ok".
For this example we will be using the following:
WSDL: https://services.omnitracs.com/qtracsWebWS/services/QTWebSvcs/wsdl/QTWebSvcs.wsdl
Namespace: QTWebService
You should now see the service reference in the Solution Explorer.
Right click the service, then click "Update Service Reference" to update the service reference.
Invoking a Web Service Method
After adding a service reference, Visual Studio automatically creates classes containing the methods and data types defined in the WSDL.
For this example we will invoke the getCounts method in Vehicle Management.
The getCounts methods takes a coverage identifier (optional) as a parameter. getCount returns a Counts object that contains several totals that are important for vehicle management.
The follow code will invoke the getCounts method.
|
Editing the app.config file
Add the following custom headers element to each endpoint element. Note: You will need to change USER, COMPANY, and PASSWORD to the appropriate values.
|
Add the following identity element to each endpoint element.
|
For this example the app.config file should look like this:
|