OperationContractAttribute.ReplyAction 속성

정의

작업의 회신 메시지에 대한 SOAP 동작 값을 가져오거나 설정합니다.

public:
 property System::String ^ ReplyAction { System::String ^ get(); void set(System::String ^ value); };
public string ReplyAction { get; set; }
member this.ReplyAction : string with get, set
Public Property ReplyAction As String

속성 값

String

회신 메시지에 대한 SOAP 동작 값입니다.

예외

ReplyAction이(가) null인 경우

예제

다음 예제는 입력 및 출력(또는 회신) 메시지의 SOAP 작업을 명시적으로 제어하기 위해 해당 및 ReplyAction 속성을 사용하는 Action 서비스입니다. 또한 이 속성을 사용하여 Name 메타데이터에 노출되는 작업의 이름을 선언합니다.

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());
    }
  }
}
Imports System.ServiceModel
Imports System.ServiceModel.Channels
Imports 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")> _
        Function SampleMethod(ByVal msg As String) As String

    <OperationContractAttribute(Action := "*")> _
    Sub UnrecognizedMessageHandler(ByVal msg As Message)
  End Interface

  Friend Class SampleService
      Implements ISampleService
    Public Function SampleMethod(ByVal msg As String) As String Implements ISampleService.SampleMethod
      Console.WriteLine("Called with: {0}", msg)
         Return "The service greets you: " & msg
    End Function

    Public Sub UnrecognizedMessageHandler(ByVal msg As Message) Implements ISampleService.UnrecognizedMessageHandler
      Console.WriteLine("Unrecognized message: " & msg.ToString())
    End Sub
  End Class
End Namespace

설명

회신 메시지의 작업 헤더에 특정 값을 지정하는 것 외에도 문자열 "*"(별표)를 지정할 수도 있습니다. 서비스에서 별표 지정은 메시지에 회신 작업을 추가하지 않도록 WCF에 지시합니다. 이는 메시지에 대해 직접 프로그래밍하는 경우에 유용합니다. 클라이언트 애플리케이션에서 별표를 지정 하면 WCF 회신 동작을 확인 하도록 지시 합니다.

적용 대상