Customizing the WebMethod Attribute

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 5.  Basic Web Services


Customizing the WebMethod Attribute

You can customize your Web service in a number of ways by adding properties to the WebMethod attribute. Table 5.1 shows the properties that you can use to customize the Web method's behavior.

Table 5.1. Properties of the WebMethod Attribute

Property

Meaning

BufferResponse

Indicates whether the response should be buffered. If set to true (the default), the entire response is buffered until the message is completely serialized and is then sent to the client. If set to false, the response is sent to the client as it is serialized.

CacheDuration

Specifies the number of seconds that ASP.NET should cache results on the server. The default is 0, which disables caching.

Description

Supplies a description for the Web method.

EnableSession

Indicates whether the session state should be enabled. The default is false.

MessageName

Specifies the name by which the method will be called in SOAP messages. The default is the method name.

TransactionOption

If set to TransactionOption.Required or TransactionOption. RequiresNew, enables the Web method to participate as the root object of a transaction. The default is TransactionOption. Disabled.

graphics/note_icon.gif

You should set the BufferResponse property to true when you're returning more than 16KB of data and that data is being constructed on the fly for example, when you are retrieving and formatting records from a database.


graphics/caution_icon.gif

You should be cautious about using session state in a Web service because it can tie up server resources for an extended period of time. If you use session state with a popular Web service, you will apply heavy demands to random access memory (RAM) on your Web server.



    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

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