Serializing Response received from WCF service with DataContractSerializer RRS feed

  • Question

  • We are trying to capture the request and response to/from WCF services in our log.

    When serializing the response received from WCF service using DataContractSerializer, the serialized response is not containing the properties of the message contract, it just contains namespace information.

    But we are able to capture the properties of message contract when we use XML Serializer instead of DataContractSerializer. These requires changing our base message contract to have a public properties instead of internal which we dont want to.

    Is there anyway to capture the properties of message using DataContractSerializer?

    Tuesday, February 10, 2015 5:47 AM


  • Hi Rose Varghese,

    Based on your description, I know that you want to capture the properties of message, usually we use the message inspectors to help us. The message inspectors are probably the most used extensibility points of the WCF runtime. Anytime we need to log, inspect, modify or completely replace a message.

    For more information, please try to refer to the following articles:
    #WCF Extensibility – Message Inspectors: .

    Best Regards,
    Amy Peng

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 11, 2015 10:40 AM