Bug? WCF client message inspector can't inspect the initial message sent to wsHttpBinding based WCF service RRS feed

  • Question

  • Hello everyone.

    I have been struggling for 3 days now trying to modify HTTP headers sent by my WCF client. I have read many web resources and followed many advices, but it seems like all of them do the same.

    I have implemented a custom message inspector via endpointBehavior which *should* inspect each and every message my client sends to the WCF service.

    I have installed Fiddler to debug the HTTP traffic and here is the outcome:

    1st packet:

    POST https://server.uprava.djurkovic-co.me/DjurkovicService/Djurkovic.svc HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8
    Host: server.uprava.djurkovic-co.me
    Content-Length: 4448
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive


    2nd packet:

    Content-Type: application/soap+xml; charset=utf-8
    VsDebuggerCausalityData: uIDPozTBqEZdeOhJtvOPl43twlEAAAAAwxPCpGBPBkmdFkXtkXNXfUyWkcac/WZOjfKOlwbQtq8ACQAA
    MyCustomHttpHeader: some_value
    MyCustomHttpHeader2: yet_another_value
    Host: server.uprava.djurkovic-co.me
    Content-Length: 1866
    Expect: 100-continue
    Accept-Encoding: gzip, deflate

     These two are for 1 service call only.

    Normally, "BeforeSendRequest" and "AfterReceiveReply" are only called once. But then how do I get 2 calls in Fiddler and the most important question - how to manipulate the headers of that first call?

    Friday, February 3, 2012 10:59 AM