What are the steps to create a webservice?
This webservice will add 2 numbers and send to the calling client.All the below steps shown are according to VS2005 beta editor :-
1) At First create a website by clicking on File -- New WebSite.
2) By the "Visual Studio Installed Templates" click on the "Asp.NET Web Service". Now Name the figure as "Maths Web Service".
Figure:-Create WebService Project
3) By default the .NET editor has made a default webservice method known as "HelloWord" that returns a string datatype. Let's rename "Service.vb" to "Maths.vb" & "Service.asmx" to "Maths.asmx". Let's replace the "HelloWorld" with the following code shown below:-
Public Function AddTwoNumbers(ByVal Number1 As Integer, ByVal
Number2 As Integer) As Integer
Return Number1 + Number2
Figure: - Rename all your default "Service" to "Maths"
4) After the webservice is completed click on add Webreference. Generally for components we do a "Add Reference" and for Webservices we do "Add Web Reference".
Figure:-Click on Add Web Reference
5) You will be shown with a list of webservices that are known to the solutions. As we are looking for our "Maths" webservice that exist in the similar solution, we click "Webservices in this solution".
Figure: - List of webservices for browsing
6) Now your editor has located the "Maths" webservice.Now Select the webservice
Figure: - Solution shows the availability of Maths Webservice.
7)After you have clicked on "Maths" webservice you will see a search progress bar as shown. This process will start up the webservice, reference it and create a proxy for the client, so by using it client can absorb the webservice.
Figure: - Starting the webservice and creating the proxy for your solution
8)Finally you are able to get your webservice which is ready for use. Now Click on Add Reference and you will see a "Localhost" reference in your .NET solution.
Figure: - Starting the webservice and creating the proxy for your solution.
9) We need to make a client who will absorb the "Maths Webservice". Now Add "WebserviceClient.aspx" and create a UI as shown . In the button click put it in the following code. "LocalHost.The ClsMaths" is the proxy object by which you can make calls to the webservice.
Sub cmdCalculate_Click(ByVal sender As Object, ByVal e As
Dim pobjMaths As New localhost.ClsMaths lblResultDisplay.Text =