Setup


To start using the Web Services API, perform the following actions:


  • Create a new Visual Studio Windows Forms Application project. Note: other project types such as Console or .dll are supported, however, Windows Forms Projects are used for the purpose of the sample code.


  • Within the Solution Explorer, right click the project and select Add Web Reference.


  • If you are using .NET 2, right click the project and select Add Web Reference:


       


  • If you are using .NET 3 or above, right click the project, select Add Service Reference, click Advanced, then click Add Web Reference.


  • Note: Service References are supported, however, for consistency between .NET versions, Web Service references are used in all SDK documentation.


  • Enter the URL to the XIA Core Web Service using the appropriate servername, for example, http://servername/XIAConfiguration/webservice/xiacore.asmx


  • Enter XIACoreWS as the Web Reference Name.


  • Click Add Reference:


       

 

  • Enter the following code within the Form_Load method of your application:


       XIACoreWS.XIAConfigurationCoreWebService XIACore = new XIACoreWS.XIAConfigurationCoreWebService();

       

       XIACore.Credentials = System.Net.CredentialCache.DefaultCredentials;


       MessageBox.Show(XIACore.GET_XIAInformation().ServerVersion);


  • Run the application. This displays the XIA Configuration Server version in the message box.


  • Repeat the previous steps, however, this time entering the URL to the XIA Configuration Web Service using the appropriate servername, for example, http://servername/XIAConfiguration/webservice/xiaconfiguration.asmx


  • When prompted, use XIAConfigurationWS as the Web Reference Name.


  • Within Visual Studio, enter the following code:


         XIAConfigurationWS.XIAConfigurationWebService XIAConfiguration = new XIAConfigurationWS.XIAConfigurationWebService();


       XIAConfiguration.Credentials = System.Net.CredentialCache.DefaultCredentials;


  • You can now access many Item related functions through the XIAConfiguration object.



Note

The code below is used to connect to the Web Service using the currently logged in credentials of the user running the application.

It is however possible to use alternative credentials.


       XIACore.Credentials = System.Net.CredentialCache.DefaultCredentials;