アプリケーションから送信される WCF Soap 要求をログに記録していますが、ログに記録しているものと実際にネットワーク経由でサーバーに送信されるものとの間に矛盾があることを発見しました。
ここに私が記録しているものがあります:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/myinterface</Action>
</s:Header>
<s:Body>
<myinterface xmlns="http://tempuri.org/">
...
これが実際に出てくるものです(WireSharkでキャプチャ):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<myinterface xmlns="http://tempuri.org/">
...
WireShark キャプチャには、Header または Action 要素がないことがわかります。
ログに記録されたリクエストを SoapUI を介してプッシュしようとしたため、これに気付きました。
このコードを使用してリクエストをログに記録しています:
public class InspectorBehavior : IEndpointBehavior
{
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.MessageInspectors.Add(new WCFMessageInspector());
}
と:
public class WCFMessageInspector : IClientMessageInspector
{
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel)
{
Log(request.ToString());
return null;
}
と:
client.Endpoint.Address = new System.ServiceModel.EndpointAddress(address);
client.Endpoint.Behaviors.Add(new InspectorBehavior());
上記のような後処理なしで、何が起こっているのかを正確にキャプチャする方法があるかどうかは誰にもわかりませんか?