Skip to main content
Omnitracs Knowledge Base

Visual Studio 2010 Example

Install certificate

Surf to  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. 

New Project.JPG

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: 


Namespace: QTWebService

Add Ser Ref.JPG

You should now see the service reference in the Solution Explorer. 

ser ref in sol explore.JPG

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.

QTWebService.QTWebSvcsClient QTClient = new QTWebService.QTWebSvcsClient();

QTWebService.Counts ct = new QTWebService.Counts();

ct = QTClient.getCounts("");

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.


  <wsse:Security mustUnderstand="1" xmlns:wsse="">

    <wsse:UsernameToken xmlns:wsu="">


      <wsse:Password Type="">PASSWORD</wsse:Password>




Add the following identity element to each endpoint element.


  <certificateReference storeLocation="CurrentUser" x509FindType="FindBySubjectName"

                        findValue="" isChainIncluded="false" />


For this example the app.config file should look like this:

<?xml version="1.0" encoding="utf-8" ?>





                <binding name="QTWebSvcsSoapBinding" closeTimeout="00:01:00"

                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"


                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />

                    <security mode="Transport">

                        <transport clientCredentialType="None" proxyCredentialType="None"

                            realm="" />

                        <message clientCredentialType="UserName" algorithmSuite="Default" />






            <endpoint address=""

                binding="basicHttpBinding" bindingConfiguration="QTWebSvcsSoapBinding"

                contract="QTWebService.QTWebSvcs" name="QTWebSvcs">


                    <wsse:Security mustUnderstand="1" xmlns:wsse="">

                        <wsse:UsernameToken xmlns:wsu="">


                            <wsse:Password Type="">PASSWORD</wsse:Password>





                  <certificateReference storeLocation="CurrentUser" x509FindType="FindBySubjectName"

                      findValue="" isChainIncluded="false" />






Download example 

  • Was this article helpful?