0
메시지 인코딩으로 Mtom을 사용하는 타사 WCF 서비스와 통합 중입니다. 메시지 관리자 동작을 만들었으므로 request.ToString()
을 호출하여 메시지 요청 "문자열"을 볼 수 있습니다. 그러나 메시지가 mtom으로 인코딩되지 않고 MIME 부분을 포함하지 않습니다. Mtom 인코딩이 나중에 채널 파이프 라인에서 발생한다고 가정합니다. 내 질문에, 거기에 실제 송출 메시지를 볼 수있는 방법은 인코딩에 관계없이 전선을 통해 WCF 서비스로 전송됩니까?WCF - MTOM 인코딩 된 메시지 검사 BeforeSendRequest
public class InspectorBehaviorExtensionElement : BehaviorExtensionElement
{
public InspectorBehaviorExtensionElement()
{
}
public override Type BehaviorType
{
get
{
return typeof(InspectorBehavior);
}
}
protected override object CreateBehavior()
{
return new InspectorBehavior();
}
}
public class InspectorBehavior : IEndpointBehavior
{
public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
{
}
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new MessageInspector());
}
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
{
}
public void Validate(ServiceEndpoint endpoint)
{
}
}
public class MessageInspector : IClientMessageInspector
{
public MessageInspector()
{
}
public void AfterReceiveReply(ref Message reply, object correlationState)
{
Debug.WriteLine("Received the following reply: '{0}'", reply);
}
public object BeforeSendRequest(ref Message request, IClientChannel channel)
{
Debug.WriteLine("Sending the following request: '{0}'", request);
return null;
}
}