Using Web Service in Projects Developed in Microsoft Visual Studio

To use the web service, add a link to it in the developed project. To do this, select the Project/Add Service Reference item in the main menu of the Visual Studio development environment (or the same command in the context menu that opens for the project in the project browser).

In the opened dialog box specify the URL of wsdl of installed BI server or security server (the specified example describes BI server connection). Address format is given in basic description of web service connection. In the Namespace field specify name of the namespace to be created for the project and to be used to access web service resources. After that click the Go button. If the connection is successful, the name of the available web service and the list of its operations are displayed. Click the OK button. The following objects are added to the project: the System Reference folder that contains a reference to the created namespace and the App.config file. Based on the wsdl file contents, the types to be used to write the code for working with the web service, will be created in the specified namespace.

NOTE. To use types, add the Using directive in the code: using <ProjectName>.<ServiceNamespace>.

The whole list of types contains the SomPortTypeClient proxy class on connecting to BI server or SomSecPortTypeClient on connecting to security server. These classes implement methods that execute same-named operations of the web service. All the operations can be divided into the platform blocks, for which they are intended. These operations are described in the Web Service Operations section.

App.config File Settings

The App.config file contains configuration elements that control application work. File contents is presented in the XML format, file structure is described in MSDN. After connecting to web service, the following elements are generated in this file:

The following changes must be made in the App.config file:

See also:

Connecting to Web Service