Section 15.7. WebServiceBinding Attribute

15.7. WebServiceBinding Attribute

A binding, as defined by Web Services Description Language (WSDL), is to a web service as an interface is to a .NET class. That is, it defines a specific set of operations. A WebService class has a default binding, which includes all the web methods in the class not specifically associated with a non-default binding. The WebServiceBinding attribute is used to identify non-default bindings, and also to set properties of the default and non-default bindings. (The WebServiceBinding attribute comes from the WebServiceBindingAttribute class, which is contained in the System.Web.Service s namespace.)

A WebService class can have multiple WebServiceBinding attributes, each specifying a different binding. If the Name property is omitted, then that attribute will apply to the default binding. This is the case for the boilerplate WebServiceBinding attribute inserted by VS2005.

There are several properties of the WebServiceBinding attribute, listed in Table 15-1. The first two, ConformsTo and EmitConformanceClaims , are inserted into the WebService class by default by VS2005. These two properties implement the interoperability standards specified by Web Service Interoperability Basic Profiles (WS-I BP) Version 1.1. The two valid values of the WsiProfiles enumeration are BasicProfile1_1 (seen in Example 15-4), indicating conformance with WS-I BP v1.1, and None , indicating no conformance claims.

Table 15-1. WebServiceBinding attribute properties

Property

Type

Get

Set

Description

ConformsTo

WsiProfiles

The WS-I specification to which the binding claims to conform.

EmitConformanceClaims

Boolean

If true , the binding will emit conformance claims when the WSDL description is published.

Location

String

The location where the binding is defined. The default is the URL of the current web service.

Name

String

The name of the binding.

Namespace

String

The namespace associated with the binding.


As you will see in the section on the MessageName property of the WebMethod attribute, there are circumstances under which creating a new binding, with a different name, location, or namespace is helpful.



Programming ASP. NET
Programming ASP.NET 3.5
ISBN: 0596529562
EAN: 2147483647
Year: 2003
Pages: 173

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