How to implement a Web Service in .NET

Explain with code sample how to Implement a Web Service in .NET

Following is a VBScript example

"WebMethod()" converts the functions in your application into web services

Example:
<%@ WebService Language="VBScript" Class="KmToMConvert" %>

Imports System
Imports System.Web.Services

Public Class KmToMConvert :Inherits WebService
   <WebMethod()> Public Function KilometerToMeter(ByVal Kilometer As String) As String
      return (Kilometer * 1000)
      end function
end class

[WebService(Namespace = http://tempuri.org/)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
   [WebMethod]
   public string HelloWorld()
   {
       return "Hello World";
   }
}
What is ILDASM and Obfuscator in .NET?
What is ILDASM and Obfuscator in NET? - ILDASM (Intermediate Language Disassembler) - De-Compilation is the process of getting the source code from the assembly...
Explain how Obfuscator works in .NET - C#.NET
Explain how Obfuscator works in NET - Obfuscators protect the source code from being hacked...
What is an Exception in .NET?
What is an Exception in .NET? - Exceptions are errors that occur during the runtime of a program...
Post your comment