在WSE中记录未加密的SOAP消息

时间:2010-01-13 11:42:18

标签: logging encryption soap

我正在尝试记录正在发送和接收的原始SOAP消息。我有一个SoapExtension,一切都很好,但是有一个问题。我们正在使用WS-DeathStars的加密和消息签名,因此记录的是加密的SOAP消息。我需要的是找到一种方法在消息解密扩展之后和消息加密例程之前插入我的SoapExtension。我该怎么做?

1 个答案:

答案 0 :(得分:0)

好的,我明白了。这可以通过实现自定义SoapFilter来解决,该自定义应该是过滤器链中的第一个:

public class TraceAssertion : PolicyAssertion
{
    public override SoapFilter CreateClientInputFilter(FilterCreationContext context)
    {
        return new SoapTraceFilter();
    }

    public override SoapFilter CreateClientOutputFilter(FilterCreationContext context)
    {
        return new SoapTraceFilter();
    }

    public override SoapFilter CreateServiceInputFilter(FilterCreationContext context)
    {
        return null;
    }

    public override SoapFilter CreateServiceOutputFilter(FilterCreationContext context)
    {
        return null;
    }
}

public class SoapTraceFilter : SoapFilter
{
    public override SoapFilterResult ProcessMessage(SoapEnvelope envelope)
    {
        envelope.Save("c:\\log\\" + DateTime.Now.Ticks + ".soap.xml");
        return SoapFilterResult.Continue;
    }
}