Creating Web Service Project
In this tutorial you will learn about Creating a Web Service Project.
Creating Web Services
Creating a Web Service Project
Purpose: To create an XML Web service project and thereby separate the functionality of the web service from the web site:
1. On the File menu, point to New, and then click Web Site.
2. In the New Web Site dialog box, select the ASP.NET Web Service icon.
3. Enter the address of the Web server on which you will develop the XML Web service. Use http//localhost to create the new site as shown in the screenshot below:
If the web service project is being created within an already existing website then the user will be prompted to confirm whether the files at the location will have to be overwritten. Since our project is new, this dialog will not appear on our example.
If your web site is not configured for asp.net 2.0 then the user will have one more dialog like the one shown below:
The user may choose yes in both cases or make a decision based on facts. For the current project the user will click YES.
Visual Studio automatically creates the necessary files and references to support an XML Web services. Right click on the solution in the solution explorer and choose new item on the context menu. In the dialog box that appears choose WebService. This shown below:
The Web service is created and the code for this is given below:
< %@ WebService Language="VB" CodeBehind="~/Application_Code/TestService.vb" Class="TestService" % >
The CodeBehind file that contains the codes for the Web Service is automatically created by the Visual Studio. The codes generated are given below:
Public methods codes can be added to methods within the Web service class to expose the functionality of some activity to other applications.
Once this is done the Web service has been successfully created and the user can browse the URL. The screenshot below will appear on the user’s computer monitor.
The description of the service will be as under:
The SOAP request and post information is shown below: