WebService Attribute
The WebService
attribute (not to be confused with the WebMethod
attribute or the WebService
directive) allows you to add additional information to a web service. The WebService
attribute is optional, though VS2005 inserts a default WebService
attribute.
Here is the syntax for a WebService
attribute:
[WebService(PropertyName=value)]
PropertyName
is a valid property accepted by the WebService
attribute (these are described shortly), and value
is the value to be assigned to that property.
If there are multiple WebService
properties, separate each property/value pair with a comma within a single set of parentheses as in this example:
[WebService (Description="A stock ticker using C#.", Name="StockTicker", Namespace="www.LibertyAssociates.com")]
There are three possible properties for a WebService
attribute, described in the next three sections.
Description Property
The WebService
attribute’s Description
property assigns a descriptive message to the web service. As with the WebMethod
attribute’s Description
property, the WebService
description will be displayed in the web service help page when the page is tested in a browser and will be made available in the SOAP message to any potential consumers of the web service.
Name Property
The name of a web service is displayed at the top of a web service help page when the page is tested in a browser and is made available to any potential consumers.
By default, the name of a web service is the name of the class implementing the ...
Get Programming ASP.NET, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.