views:

131

answers:

1

I have a simple wcf service which uses basicHttp binding, I want to pass few information from client to this service via custom SOAP header. My client is a .net application targetting .Net 1.1, using visual studio I have created the proxy( Added a new web reference pointing to my WCF service) I am able to call methods in the WCF service but not able to pass the data in message header. Tried to override "GetWebRequest" and added custom headers in the proxy but for some reason when I tried to access the header using "OperationContext.Current.IncomingMessageHeaders.FindHeader" it is not thier.

Any idea how to solve this prob?

This is how I added the headers

protected override System.Net.WebRequest GetWebRequest(Uri uri)

{

HttpWebRequest request; request = (HttpWebRequest)base.GetWebRequest(uri); request.Headers.Add("tesData", "test");
return request;

}

A: 

Hi!

You try to use very exotic way! .NET 1.1 - it's retro now. But now back to you problem. I am sure that you can implement all what you needs with respect of HttpWebRequest and HttpWebResponse classes. You should look at the automatically generated proxy an on a template. It will work on .NET 1.0 also.

Probably if would be enough to make only a small modification in generated proxy code. For example instead of overriding an existing method of the proxy you can add a new one where you place new data in the HTTP header with respect of request.Headers.Add.

If it will be not works, you can reduce your server and client code to the minimum and add this code to you question. Then one could reproduce your problem and better help you.

Regards

Oleg