Hello!
Is it possible, while calling a service using System.Net.WebClient, to add a IDispatchMessageInspector behavior, just like with a real channel?
I made a winform tester for all our webservices, and all the testers are listed in a XML file, with the attributes, no contracts no proxy, it allowed much more flexibility for testing and for generating fields corresponding to the attributes.
So I generate the envelope in a string and call the services using WebClient class. So far, so good. It works. I'm happy.
The problem:
In our organization,
a header is added with some informations about the caller,
and a behavior is added so that information can be validated before the service is actually called,
Dimcontexte
AsNewUtiliseContexteSessionWCFAttribute()
ServiceWCF.Endpoint.Contract.Behaviors.Add(contexte)
UtiliseContexteSessionWCFAttribute which implements IContractBehavior, and adds a messageinspector
on Then,
AfterReceiveRequest on the server side, takes the customheader and validates it against tokens previously generated, and that allows access to the service.
Is it possible to hack my way to put a behavior in a WebClient or HttpWebRequest? Thank you!!!