Creating a WebService Using VisualStudio.NETWe read about .NET Framework and Web Services Basics. Here we are going to learn how to create a WebService using VS.NET (using VB.NET.) and Consume the Webservice from VB.NET Client. This Article is based on VS.NET RC1 Release.Step 1Launch VS.NET IDE and create a new project, New project Dialog Box will open and select Project Type as a Visual Basic projects and Templates as ASP.NET WebService as shown below.Then click "OK" . This will create a virtual directory under Default web site (IIS). Step 2Select Service1.asmx and double click that will take you to the code window. As shown below. WebService will have .asmx extension.In this code window we can add a method (Webmethod) that exposes to call over the Internet this type of method called WebMethod.The Attribute WebMethod is very important. This will allow method to invoke over the Web using SOAP.First we need to specify a WebMethod Attribute and the Function or Sub name,for example: <WebMethod()> Public Function Add(ByVal Num1 As Integer, ByVal Num2 As Integer) As IntegerReturn Num1 + Num2End FunctionStep3In the code window edit Add and Div Web methods as shown above, and then build (compile) the project. If compiling successfully, view Service1.asmx in Browser. This will shows Add and Div methods. (Using HTTP-GET). This is generated by VS.NET.Enter the num1 and num2 values click Invoke, this will invoke Add method in Service1.asmx using HTTP-GET (this is different from calling a method through SOAP ). ResultUsing HTTP-GET we tested the service1.asmx webservice. This default Interface, which provided by VS.NET. Next we will see how to consume this same service using SOAP. The following CODE SNIPPET gives the information about SOAP Request and Response Messages.Consuming the WebService from VB.NET Client
Every SOAP message has Envelope, Header, and Body. The above SOAP Request Message posted to http://localhost/Mathfunctions/Services1.asmx URL. The corresponding SOAP Response message is show below with Result.Using POST Method SOAP Request Message is posted to the Web Server. SOAP Response Message as a result. SummaryIn this article we understand how to Create and test Web Service Using VisualStudio.NET.
Intergrating with google Search API
Authenticate Web Service Client - Windows Application