i try to consume a SOA Service. I generate a Service Reference from the wsdl and then I instantiate a client object with my binding configuration, it is a basicHttpBinding.
Then i implement a custom behavior and a message inspector and there I add my custom header properties like shown below...
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
request.Properties.Add("CONTENT-TYPE", "text/xml;charset=UTF-8");
request.Properties.Add("PropertyOne", "One");
request.Properties.Add("PropertyTwo", "Two");
return null;
}
Then, when I try to consume the service, I get always the Error message
(502) Bad Gateway.
With fiddler I look at the raw http data send to the service, the custom properties aren't in the header.