Steps to create a webservice, DOT NET Programming

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".

2033_webservice project.png

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

End Function

707_webservice project1.png

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".

1295_webservice project2.png

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".

370_webservice project3.png

Figure: - List of webservices for browsing

6) Now your editor has located the "Maths" webservice.Now Select the webservice

505_webservice project4.png

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.

562_webservice project5.png

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.

782_webservice project6.png

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 =

Convert.ToString(pobjMaths.AddTwoNumbers(Convert.ToInt16(txtNumber1.Text), Convert.ToInt16(txtNumber2.Text)))

End Sub

681_webservice project7.png

Posted Date: 9/22/2012 2:23:45 AM | Location : United States

Related Discussions:- Steps to create a webservice, Assignment Help, Ask Question on Steps to create a webservice, Get Answer, Expert's Help, Steps to create a webservice Discussions

Write discussion on Steps to create a webservice
Your posts are moderated
Related Questions
Explain the new features in ADO.NET Entity Framework 4.0. ADO.NET Entity Framework 4.0 is introduced in .NET Framework 4.0 and contain the following new features: Persisten

I am looking individuals who have company experience working on Jquery and Microsoft Technology ( MVC 4.5 ), who will take live online session and provide training through Team Vie

Question: (a) Give three key differences between the DetailsView and FormView controls. (b) The ASP.NET 2.0 Framework introduces the idea of validation groups. How Valida

How would ASP and ASP.NET apps run at the same time on the same server? Both ASP and can be run at similar server, becuase IIS has the capability to respond/serve both

What are shared (VB.NET)/Static(C#) variables? Shared/Static classes are used when a class gives functionality which is not specific to any instance. In brief if you want an ob

How can we know a state of a thread? The "ThreadState" property is used to get complete detail of a thread. The Thread can have one or a combination of status.System.Threading.

Question: (a) Using the help of a diagram, describe the layer of the .NET framework that sits between Visual Basic.NET 2005 and the operating system. (b) Explain the charac

CRM and Shaerpoint We are using 365+ CRM in the cloud for QuattroCitta at the moment which we will migrate to our own private cloud in six months (project part 2). Within ShareP

What is Operator Overloading in .NET? It gives a way to define and use operators like +, -, and / for user-defined classes or structs. It permits us to define/redefine the way

Program for Solution of Linear Equations - C# Program Hello, I've been trying so many codes for this but those codes didn't work well. Please write a Program for solving Linea