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

System.EventArgs)

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
I am seeking asp.net developers, and will raise depends on skills and work, we are a web development firm in mexico and i want full time developers that can focus 100 percent my pr

How can you increase SQL performance? 1)Keep your indexes as narrow as possible. This reduces the size of the index and decrease the number of reads needed to read the index.

Which property on a Combo Box do you set with a column name, prior to setting the Data Source, to display data in the combo box? ComboBox.DataValueField = "ColumnName" When

I need Custom Login Page for Sharepoint 2013 with Active Directory Project Description: I would like to prepare a webpart or an application for Sharepoint 2013 foundation.

Web Developer Project Description: We are in need of an expert web developer for long term connection; please apply with samples if you have the subsequent skills: ASP.NET

The Problem with finalize is that the garbage collection has to make 2  rounds in order to remove the  objects which have finalize methods. The figure below will make things cle

Have you ever worked with Microsoft Application Blocks, if yes then which? The Application Blocks are C# & the VB.NET classes distributed as the Visual Studio projects which ca

What is the difference between OLEDB Provider and SqlClient? With respect to usage, there is no difference among OLEDB Provider and SqlClient. The dissimilarity lies in their p

What is Unicode? In order to understand the concept of Unicode we require  to move a little back and understand the ANSI code. The ASCII (ask key) stands for American Standard

Define Network? A network is a set of devices linked by physical media links. A network is recursively is a connection of two or more nodes by a physical link or two or more