Part of PraVeeN's adventure in DOTNET, C#
Anyway hope this will be help ful for Webservice starting people
Creating a webservice application with dotnet is simple as A B C….
Just select “Web Service” from create a new window. All the necessary code will be premade by windows itself
Which will look like this:
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
}
The web application is over and now you can create an application for accessing this web service
Here I used a standard C# Windows application. Add “Web Reference” to your web service. (Eg: http://pvn/WebService/Service.asmx).
Now place a button on the form and type the following C# code
private void button1_Click(object sender, EventArgs e)
{
pvn.Service s = new WindowsApplication1.pvn.Service();
MessageBox.Show(s.HelloWorld());
}
Web Service Over!!!
I found this link and felt very useful:
http://abstractvb.com/code.asp?A=1006
Leave a passing comment »