System.ServiceModel 4.0.0.0 System.Attribute System.AttributeUsage(System.AttributeTargets.Method)

Apply the to a method to indicate that the method implements a service operation as part of a service contract (specified by a attribute).

Use the properties to control the structure of the operation and the values expressed in metadata:

The property specifies the action that uniquely identifies this operation. Indigo2 dispatches request messages to methods based on their action.

The property indicates that the operation is implemented or can be called asynchronously using a Begin/End method pair.

The property indicates whether the property has been explicitly set.

The property indicates that the operation only consists of a single input message. The operation has no associated output message.

The property specifies whether this operation can be the initial operation in a session.

The property specifies whether indigo2 attempts to terminate the current session after the operation completes.

The property specifies the message-level security that an operation requires at run time.

The property specifies the action of the reply message for the operation.

The attribute declares that a method is an operation in a service contract. Only methods attributed with the are exposed as service operations. A service contract without any methods marked with the exposes no operations.

The property indicates that a pair of Begin<methodName> and End<methodName> methods form a single operation implemented asynchronously (whether on the client or the service). The ability of a service to implement operations asynchronously is a service implementation detail and is not exposed in metadata (such as Web Services Description Language (WSDL)).

Similarly, clients can choose to invoke operations asynchronously independent of how the service method is implemented. Calling service operations asynchronously in the client is recommended when a service method takes some time but must return information directly to the client. For details, see .

The property indicates that a method does not return any value at all, including an empty underlying response message. This type of method is useful for notifications or event-style communication. Methods of this kind cannot return a reply message so the method's declaration must return void.

When programmatically retrieving the information store in this attribute, use the class instead of reflection.

If the property is set to false, (the default), even methods that return void are two-way methods at the underlying message level. In this case, the infrastructure creates and sends an empty message to indicate to the caller that the method has returned. Using this approach enables the application and the infrastructure to send error information (such as a SOAP fault) back to the client. Setting to true is the only way to prevent the creation and dispatch of a reply message. For more information, see One-Way Services.

The and properties can be used not only to modify the default action of SOAP messages but also to create handlers for unrecognized messages or to disable adding actions for direct message programming. Use the property to prevent clients from calling a particular service operation prior to other operations. Use the property to have indigo2 close the channel after clients call a particular service operation. For more information, see Using Sessions.

The property enables you to specify on the operation contract whether the operation messages are signed, encrypted, or signed and encrypted. If a binding cannot provide the security level required by the contract, an exception is thrown at run time. For more information, see and Understanding Protection Level.

Indicates that a method defines an operation that is part of a service contract in a indigo1 application.

- Constructor
  4.0.0.0
  To be added.

  Initializes a new instance of the class.

- Property
  4.0.0.0
  System.String To be added.

  Use the property to control the action of the method's input message. Because indigo2 uses this action to dispatch an incoming message to the appropriate method, messages used within a contract operation must have unique actions. The default action value is a combination of the contract namespace (the default value is "http://tempuri.org/"), the contract name (interface name or the class name, if no explicit service interface is used), the operation name, and an additional string ("Response") if the message is a correlated response. You can override this default with the property.

  To indicate that a service operation handles all messages that the service receives but cannot be directed to a service operation, specify the value "*" (an asterisk). This type of operation, called an unmatched message handler, must have one of following method signatures, or a is thrown:

  The service operation can take only a object and return a object.

  The service operation can take only a object and return nothing (that is, return void).

  A service contract can have only one service operation with the property set to "*". Any group of service contracts hosted at the same listenUri that a service class implements can have many service operations with the property set to "*" when the property is set to false. However, only one of those service operations can have the property set to "*" and the property set to true. For more details, see .

  Gets or sets the WS-Addressing action of the request message.

- Property
  4.0.0.0
  System.Boolean To be added.

  Use the property to build service operations that can be called asynchronously on the server, the client, or both. The property informs the runtime that a Begin method has a matched End method that conforms to the .NET Framework asynchronous method design pattern. Building server asynchronous methods that implement a service operation increases server scalability and performance without affecting the clients of the service, and is recommended when a service operation must return something to the client after performing a lengthy operation that can be performed asynchronously.

  Clients remain unaffected because the asynchronous method pair on the server is an implementation detail that does not affect the underlying Web Services Description Language (WSDL) description of the operation. Such methods appear to clients as a single operation with <input> and correlated <output> messages. indigo2 automatically routes inbound messages to the Begin<methodName> method and routes the results of the End<methodName> call to the outbound message. Client channels, therefore, can represent the method pair as either a single synchronous operation or as an asynchronous operation pair. In no case does the client representation affect the asynchronous implementation on the server in any way.

  Client contracts can use the property to indicate an asynchronous method pair that the client can use to invoke the operation asynchronously. Typically, client applications use the ServiceModel Metadata Utility Tool (Svcutil.exe) tool and the /async option to generate a Begin<methodName> and End<methodName> method pair that the client can use to invoke the operation asynchronously.

  If a service operation has both an asynchronous and a synchronous version, the default behavior on the service is to invoke the synchronous version.

  Indicates that an operation is implemented asynchronously using a Begin<methodName> and End<methodName> method pair in a service contract.

- Property
  4.0.0.0
  System.Boolean To be added.

  Use the property to determine whether a specific protection level is required by the messages of this operation.

  Gets a value that indicates whether the messages for this operation must be encrypted, signed, or both.

- Property
  4.0.0.0
  System.Boolean To be added.

  The property controls whether an operation can be the first operation called when a session is created.

  The value of must be either or and the binding used must require or allow sessions for the property to work properly.

  The default is true, which means that an operation can be the first one called on a channel. Subsequent calls to the initiating method have no effect, other than to call the method. No other sessions are created. If the contract does not make use of a session, setting to false is ignored.

  Typically, you set to false to force clients to call another method on the service before they can invoke this one. For example, if your service has a series of operations that depend on an order ID number, you can set to true for a GetOrderId service operation and set all remaining service operations to false. This ensures that each new client obtains an order ID prior to using the other methods exposed by the service.

  There is an interaction between and the property. A service contract can have only one service operation with the property set to "*". Any group of service contracts hosted at the same listen URI that a service class implements can have many service operations with the property set to "*" when the property is set to false. However, only one of those service methods can have the property set to "*" and the property set to true.

  If a service receives a message for a non-initiating operation, the service returns an ActionNotSupported SOAP fault. The client experiences this as an . If a client calls a non-initiating operation first, the client runtime throws an .

  For more information, see Using Sessions.

  Gets or sets a value that indicates whether the method implements an operation that can initiate a session on the server (if such a session exists).

- Property
  4.0.0.0
  System.Boolean To be added.

  Use the property to indicate that an operation does not return a reply message. This type of operation is useful for notifications or event-style communication, especially in two-way communication. Without waiting for an underlying response message, callers of one-way operations have no direct way to detect a failure in processing the request message. (Service applications that use reliable channels and one-way operations can detect a message delivery failure at the channel level. For details, see Reliable Sessions Overview.)

  In duplex (or two-way) service-oriented applications in which the client and server communicate with each other independently, a client channel can use the property on its methods to indicate that the service can make one-way calls to the client that the client can treat as events. No return call or message is generated because the service does not expect any response message.

  If the property is set to false (the default), even methods that return void result in a reply message. In this case, the infrastructure creates and sends an empty message to indicate to the caller that the method has returned. (Using this approach enables the infrastructure to send SOAP faults back to the client.) Setting to true is the only way to cancel the creation and dispatch of a response message.

  One-way methods must not return a value or have ref or out parameters; otherwise a exception is thrown.

  Specifying that an operation is a one-way operation means only that there is no response message. It is possible to block if a connection cannot be made, or the outbound message is very large, or if the service cannot read inbound information fast enough. If a client requires a non-blocking call, generate operations. For more information, see One-Way Services and Consuming Services Using a Client.

  Gets or sets a value that indicates whether an operation returns a reply message.

- Property
  4.0.0.0
  System.Boolean To be added.

  Use the property to indicate that calling a service operation terminates the communication session.

  In a client application, a value of set to true instructs indigo2 to close the channel after the reply arrives.

  In a service, a timer is set and the channel aborts if the client does not close the channel within that period.

  For more information about using this property with sessions, see Using Sessions.

  If a caller is listening for the event for an operation, it is possible to block when the response is received. The proper way to handle this is to schedule work on another thread when is raised and then immediately return from that event handler.

  Gets or sets a value that indicates whether the service operation causes the server to close the session after the reply message, if any, is sent.

- Property
  4.0.0.0
  System.String To be added.

  Use the property to override the <operation> element name in WSDL. The default operation name is the name of the implementing method.

  Gets or sets the name of the operation.

- Property
  4.0.0.0
  System.Net.Security.ProtectionLevel To be added.

  Use the property to control whether the messages of an operation must be encrypted, signed, or both. The value set here is the default value for all messages specified for this operation unless a narrower scope overrides this value.

  It is important to remember that the protection behavior at runtime is the combination of the protection-level values set on the following properties. These properties have a hierarchical structure. Setting the outermost value establishes the default setting for all narrower scopes unless a different value for a narrower scope is explicitly set. In this case, the outer value remains the default for all narrower scopes with the exception of that specifically set.

  For example, if is set to and no other narrower scopes have protection level settings, all messages in an operation contract are encrypted and signed. If, however, one of those operations has the set to , then the messages for that operation are signed but all other messages in the contract are encrypted and signed.

  For details about protection levels and their assumptions and scopes, see Understanding Protection Level.

  The scopes at which these values are set are:

  The property on .

  The property on .

  When there is no protection level explicitly specified on the contract and the underlying binding supports security (whether at the transport or message level), the effective protection level for the whole contract is . If the binding does not support security (such as ), the effective is for the whole contract. The result is that depending upon the endpoint binding, clients can require different message or transport level security protection even when the contract specifies .

  Gets or sets a value that specifies whether the messages of an operation must be encrypted, signed, or both.

- Property
  4.0.0.0
  System.String To be added.

  In addition to specifying a particular value for the action header of the reply message, you can also specify the string "*" (an asterisk). Specifying an asterisk in the service instructs indigo2 not to add a reply action to the message, which is useful if you are programming against messages directly. Specifying an asterisk in a client application instructs indigo2 not to validate the reply action.

  Gets or sets the value of the SOAP action for the reply message of the operation.