The WebService attribute provides the following properties:
- Description – The value of this property contains a descriptive message that is displayed to prospective consumers of the XML Web service when description documents for the XML Web service are generated, such as the service description and the service help page.
- Name – The value of this property contains the name for the XML Web service. By default, the value is the name of the class implementing the XML Web service. The Name property identifies the local part of the XML qualified name for the XML Web service. The Name property is also used to display the name of the XML Web service on the service help page.
- Namespace – The value of this property contains the default namespace for the XML Web service. XML namespaces offer a way to create names in an XML document that are identified by a Uniform Resource Identifier (URI). By using XML namespaces you can uniquely identify elements or attributes in a XML document. So, within the service description for an XML Web service, Namespace is used as the default namespace for XML elements directly pertaining to that XML Web service. If not specified, the default namespace is used,
http://tempuri.org/.
How to use these attributes
The WebMethod attribute provides the following properties:
- BufferResponse – When set to true, the default setting, ASP.NET buffers the entire response before sending it to the client. The buffering is very efficient and helps improve performance by minimizing communication between the worker process and the Internet Information Services (IIS) process. When set to false, ASP.NET buffers the response in chunks of 16 KB. Typically, you set this property to false only if you do not want the entire contents of the response in memory at one time. For example, you are writing back a collection that is streaming its items out of a database.
- CacheDuration – Specifies for how many seconds ASP.NET should cache the results for each unique parameter set. The default value is zero, which disables the caching of results.
- Description – Supplies a description for an XML Web service method, which appears on the service help page. The default value is an empty string.
- EnableSession – When set to false, the default setting, ASP.NET cannot access the session state for an XML Web service method. When set to true, the XML Web service can access the session state collection directly from HttpContext.Current.Session or with the WebService.Session property if it inherits from the WebService base class.
- MessageName – Enables the XML Web service to uniquely identify overloaded methods using an alias. Unless otherwise specified, the default value is the method name. When specifying a value for MessageName, the resulting SOAP messages will reflect this name instead of the actual method name.
- TransactionOption – Specifies whether the XML Web service method can participate as the root object of a transaction. Even though you can set the TransactionOption property to any of the values of the TransactionOption enumeration, an XML Web service method only has two possible behaviors; it does not participate in a transaction (Disabled, NotSupported, Supported), or it creates a new transaction (Required, RequiresNew). Unless otherwise specified, the default value is TransactionOption.Disabled. To use this property, you need to add a reference to System.EnterpriseServices.dll. This namespace contains methods and properties that expose the distributed transaction model found in COM+ services. The System.EnterpriseServices.ContextUtil class lets you vote on the transaction using the SetAbort or SetComplete methods.
How to use these attributes
Extracted from the article : Getting Started with XML Web Services in Visual Basic.NET and Visual C#