Try my app Expense Manager @ google play and amazon store.

Monday, July 2, 2012

Implement a Web Service in .NET

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

Following is code in VBScript and C# both respectively.

In VBScript :

<%@ 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

In C# :

[WebService(Namespace =]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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
     public string HelloWorld()
            return "Hello World";

No comments:

Post a Comment

Follow by Email

Google+ Badge