WebService Attribute


WebService Attribute

Class

System.Web.Services.WebServiceAttribute

Applies To

Class

Constructor

     New(  ) 

Properties


Description (String)

A textual description of the web service. The description is displayed in the Service Description page and the Web Service Help page.


Name (String)

The name to be assigned to the web service. Ordinarily, the web service name corresponds to the name of the class. However, the Name property of the <WebService> attribute is used instead of the class name as the name of the web service.


Namespace (String)

The web service's namespace. During development, the namespace http://tempuri.org/ is used by default. However, a unique namespace should be assigned to any production web service. Although the namespace for a web service resembles a URL, it need not point to any valid Internet resource.

Description

The <WebService> attribute is used to assign a namespace and a description to an ASP.NET web service. Each web service must also include the "@ WebService" directive.

Example

The example uses an ".asmx" file with the following contents:

     <%@ WebService Language="VB"         Codebehind="Hello.asmx.vb" %> 

It has the following code-behind file:

     Option Strict     Imports System.Web.Services     <WebService(Name:="Hello", _        Description:="Displays a greeting to the user.", _        Namespace:="http://www.oreilly.com/VbNet")> _     Public Class HelloWebService        <WebMethod> Public Function SayHello(ToWhom As String) As String           Return "Hello, " & ToWhom        End Function     End Class 

See Also

WebMethod Attribute




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net