Introduction:
The WebService attribute is used for giving a description (generally, about using the service ) of a web service by adding
some information. Here I am describing it's properties by which we add
description to web service.
- Description
- Name
- Namespace
At first we create a web service without using any properties (Given above)
of the Web Service. Then we will use these properties in the web service.
Creating a Simple Web Service:
Use the following steps to create a web service.
- Go to Visual Studeo 2010 and create a New Project
- Select .NET Framework 3.5
- Create an ASP.NET Web Service Application
- Give it a name and click ok button
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace
WebSA
{
///
<summary>
/// Summary
description for Service1
///
</summary>
[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
show()
{
return
"This is example for WebService Attribute's Property";
}
}
}
Run the service application.




Jessica StephenPosted Dec 9, 2011, 5:30 AM
Definitely helpful article.