mercredi 5 août 2015

How to modify soap message using IClientMessageInspector

Please tell me how one can modify SOAP message using IClientMessageInspector Here is my code of ClientMessageInsepctor

public class MyClientMessageInspector : IClientMessageInspector
{
    public object BeforeSendRequest(
        ref Message request,
        IClientChannel channel)
    {
        // TODO: log the request.

        // If you return something here, it will be available in the 
        // correlationState parameter when AfterReceiveReply is called.
        string s = request.ToString();
        return null;
    }

    public void AfterReceiveReply(
        ref Message reply,
        object correlationState)
    {
        // TODO: log the reply.

        string s = reply.ToString();
        s.Replace("XXX", "YYY");

        // If you returned something in BeforeSendRequest
        // it will be available in the correlationState parameter.
    }


}

How can I create a Message reply from modified string s variable?




Aucun commentaire:

Enregistrer un commentaire