This documentation is archived and is not being maintained.

ClientOperation Class

Used to modify or extend the execution behavior of a specific contract operation in a client object or client channel object. This class cannot be inherited.

System.Object
  System.ServiceModel.Dispatcher.ClientOperation

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public sealed class ClientOperation

The ClientOperation type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibraryClientOperation(ClientRuntime, String, String)Initializes a new instance of the ClientOperation class using the specified ClientRuntime, name, and action values.
Public methodSupported by Portable Class LibraryClientOperation(ClientRuntime, String, String, String)Initializes a new instance of the ClientOperation class using the specified ClientRuntime, name, action, and reply action values.
Top

  NameDescription
Public propertySupported by Portable Class LibraryActionGets the action of the operation.
Public propertySupported by Portable Class LibraryBeginMethodGets or sets the method associated with an asynchronous operation.
Public propertySupported by Portable Class LibraryDeserializeReplyGets or sets a value that indicates whether the Formatter property value is used to deserialize the reply message.
Public propertySupported by Portable Class LibraryEndMethodGets or sets the method that implements the asynchronous end method for the operation.
Public propertyFaultContractInfosGets a collection of FaultContractInfo objects that represent the specified SOAP faults for this operation.
Public propertySupported by Portable Class LibraryFormatterGets or sets the formatter that serializes objects into messages and deserializes messages into objects.
Public propertySupported by Portable Class LibraryIsInitiatingGets or sets a value that indicates whether a session can be started by a message to this operation.
Public propertySupported by Portable Class LibraryIsOneWayGets or sets a value that indicates if the operation is a one-way operation.
Public propertySupported by Portable Class LibraryIsTerminatingGets or sets a value that indicates if this operation is the last one in a session.
Public propertySupported by Portable Class LibraryNameGets the name of the operation.
Public propertyParameterInspectorsGets or sets a collection of IParameterInspector objects that can inspect and modify inbound and outbound objects for a particular client method.
Public propertySupported by Portable Class LibraryParentGets the containing ClientRuntime object.
Public propertySupported by Portable Class LibraryReplyActionGets the action of the reply message for this operation.
Public propertySupported by Portable Class LibrarySerializeRequestGets or sets a value that specifies whether the Formatter object serializes an outbound message.
Public propertySupported by Portable Class LibrarySyncMethodGets or sets the method that is associated with this operation.
Top

  NameDescription
Public methodSupported by Portable Class LibraryEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Portable Class LibraryFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Portable Class LibraryGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Portable Class LibraryGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Portable Class LibraryMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Portable Class LibraryToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The ClientOperation class is the location for client run-time modifications and insertion point for custom extensions that are scoped to only one service operation. (To modify client run-time behavior for all messages in a contract, use the ClientRuntime class.)

Install ClientOperation modifications using a custom client behavior object, either of type IContractBehavior (to find a particular operation to modify) or of type IOperationBehavior (which can then be applied by creating a custom attribute).

Use the Operations property to locate the ClientOperation object that represents a particular service operation.

For more information about clients and the client architecture, see Consuming Services Using a Client and Client Architecture. For more information about customizing the client runtime, see Extending Clients. For more information about using behaviors, see Attaching Extensions Using Behaviors.

The following properties enable you to insert custom objects or modify the client execution behavior:

  • Use the Formatter property to insert a custom IClientMessageFormatter implementation for an operation or modify the current formatter.

  • Use the ParameterInspectors property to insert a custom IParameterInspector implementation or to modify the current one.

  • Use the SerializeRequest property to control who serializes an outbound message.

  • Use the DeserializeReply property to control who deserializes an inbound message.

  • Use the Action property to access the WS-Addressing action of the request message and the ReplyAction property to access the response message action.

  • Use the BeginMethod and EndMethod to specify which client methods are associated with an asynchronous operation.

  • Use the FaultContractInfos property to get a collection of specified types that can appear in SOAP faults as the detail type.

  • Use the IsInitiating and IsTerminating properties to control whether a session is initiated or is torn down, respectively, when the operation is called.

  • Use the IsOneWay property to control whether the client waits for a response before completing the invocation.

  • Use the Parent property to obtain the containing ClientRuntime object.

  • Use the Name property to get the name of the operation.

  • Use the SyncMethod property to control which method is mapped to the operation.

The following code example shows an System.ServiceModel.Description.IEndpointBehavior inserting a custom parameter inspector into each ClientOperation in the ClientRuntime.Operations property.


#region IEndpointBehavior Members
public void AddBindingParameters(
  ServiceEndpoint endpoint, BindingParameterCollection bindingParameters
) { return; }

public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
  clientRuntime.MessageInspectors.Add(new Inspector());
  foreach (ClientOperation op in clientRuntime.Operations)
    op.ParameterInspectors.Add(new Inspector());
}

public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
  endpointDispatcher.DispatchRuntime.MessageInspectors.Add(new Inspector());
  foreach (DispatchOperation op in endpointDispatcher.DispatchRuntime.Operations)
    op.ParameterInspectors.Add(new Inspector());
}

public void Validate(ServiceEndpoint endpoint){ return; }


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show: