How to Create Proxy Classes for XML Web Services
A proxy class is created on a Visual Studio project to help the programmer interact with a remote Web service. A Web service is an application that runs on a host. Programmers can use the application by calling commands defined on the Web service. For instance, the Web service may have a "Calculate" function. By using a proxy, the programmer can call "Calculate" by instantiating the class and assigning it to a variable. Creating a proxy class is accomplished using a few steps in Visual Studio.
Instructions
-
-
1
Open the project in Visual Studio. In the right side of the window, right-click the project name in "Solution Explorer." Select "WSE Settings 3.0" from the list. Select "Enable this project for Web Services Enhancements" and press "OK." This ensures that any classes created in the project are able to access the Web service proxy.
-
2
Right-click the project name again in the Solution Explorer window. Select "Add Web Reference" from the menu items. Select "Add Web Reference" from the list of options. This opens a configuration window for the proxy class.
-
-
3
Enter the URL to the Web service. This configuration screen also has the option to search for available Web services if you don't know the exact URL. Enter the domain name into the search bar and press "OK." The configuration window attempts to locate Web service URLs available on the server.
-
4
Enter a name in the textbox labeled "Web reference name." This is the name that is used to call the class in the ASP code. It can be any name that is useful to the coder.
-
5
Click the "Add Reference" button. This creates the proxy class in a directory called "Web References" in the project solution.
-
1