O'Reilly logo

VB.NET Language in a Nutshell, Second Edition by Steven Roman PhD, Paul Lomax, Ron Petrusha

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

WebService Attribute

Class

System.Web.Services.WebServiceAttribute

Applies To

Class

Description

An optional element of a web service definition (the ASP.NET @ Webservice directive is required), the <WebService> attribute can be used to assign the web service a namespace and description.

Constructor

New()

Properties

Description (String)

A textual description of the web service. The description is displayed in the Service Description page and the 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.

Example

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

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

It has the following codebehind file:

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required