OperationContractAttribute.ReplyAction Property
Gets or sets the value of the SOAP action for the reply message of the operation.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
| Exception | Condition |
|---|---|
| ArgumentNullException | ReplyAction is null. |
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 WCF 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 WCF not to validate the reply action.
The following example is a service that uses the Action and ReplyAction properties to explicitly control the SOAP actions of both the input and output (or reply) messages. It also uses the Name property to declare the name of the operation as exposed in metadata.
using System; using System.Collections.Generic; using System.ServiceModel; using System.ServiceModel.Channels; using System.Text; namespace Microsoft.WCF.Documentation { [ServiceContract(Namespace="http://Microsoft.WCF.Documentation")] public interface ISampleService{ [OperationContract( Action="http://Microsoft.WCF.Documentation/OperationContractMethod", Name="OCAMethod", ReplyAction="http://Microsoft.WCF.Documentation/ResponseToOCAMethod" )] string SampleMethod(string msg); [OperationContractAttribute(Action = "*")] void UnrecognizedMessageHandler(Message msg); } class SampleService : ISampleService { public string SampleMethod(string msg) { Console.WriteLine("Called with: {0}", msg); return "The service greets you: " + msg; } public void UnrecognizedMessageHandler(Message msg) { Console.WriteLine("Unrecognized message: " + msg.ToString()); } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.