I am using a third-party web service client (created using the "Add Service Link") to get some data.
After filling in the web service objects with the relevant data, we need to add some data to the headers (encrypted password and some other predefined data)
Then we serialize each request sent to the web service using the standard .net XmlSerializer .
However, as a result of serialization, I do not see the request headers. I searched for a long time and could not find a way to "print" them either.
Here is a sample code:
Ibooking proxy = new BookingManager(); GetAvailabilityRequest request = new GetAvailabilityRequest(); GetAvailabilityResponse response = proxy.GetAvailability(request);
I excluded the code that adds more data to the request, since it is long and complex (you need to implement IEndpointBehavior and IClientMessageInspector to "catch" the request before sending it), but for now, as a workaround, I put BreakPoint in the Message object and convert it to string using Visual Studio. This way I see the headers, but obviously this is bad practice since I want it to be automated in serialization.
source share