views:

96

answers:

1

I'm trying to log raw SOAP messages being sent and recieved. I have a SoapExtension, everything's generally working fine, but there's a problem, though. We're using WS-DeathStars' encryption and message signing, so what gets logged is an encrypted SOAP message. What I need is to find a way to insert my SoapExtension right after message decryption extension and right before message encryption routine. How do I do that?

A: 

OK, I got it working. This can be solved by implementing a custom SoapFilter, which should be the first one in filter chain:

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;
    }
}
Anton Gogolev