The OperationContract attribute, as with the ServiceContract attribute, provides for even greater control over the WSDL generation. Generally you’ll accept most of the defaults, but for certain features, such as duplex messaging, you’ll need to use options indicating the operation is one-way. Additionally, for session management, you’ll be leveraging some of the options for overall service session management.
Table 4-6 describes the properties in the OperationContract attribute type.
Table 4-6. OperationContractAttribute Properties
Class Property Description
Action
Controls the action on the request (input) message; the default is the contract namespace, contract name, and operation name. Use this in conjunction with * to indicate the operation can handle all unmatched operation requests—there can be only one of these, and it must take a message as a parameter.
AsyncPattern
Provides for the implementation of an asynchronous process on the server, client, or both tiers. This feature aids .NET clients in supporting operations with the efficiency of using a single client thread.
IsInitiating
Indicates that this operation is an initiation of a session; the default is true, so if you require session initiation, you need to set all operations to false except the initiation operation.
IsOneWay
Indicates that the operation returns nothing (void) or can’t accept out parameters. The default is false; as a result, all operations without it return an empty message that is useful for capturing exceptions. If applying the value of true to an operation that is marked with a return type other than void, WCF doesn’t throw a compiler error. Instead, it throws an InvalidOperation exception when the WCF framework inspects the ServiceContract types at runtime.
IsTerminating
Indicates this operation terminates the session and the channel should close.
Name Overrides the operation name from the method name on the interface.
ReplyAction
Controls the action on the reply (output) message. Used in conjunction with the Action property.
Wednesday, April 7, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment