I am using WCF to talk to a Java web service. This web service has a method called Authenticate that returns a session ID. Every request to this web service must contain this session ID in the SOAP header. If one's session times out, invoking any method results in a SoapException being returned. I would like to:
- Intercept every call made to the web service,
- Check the response message for this particular exception
- If found, call Authenticate again to get a new Session ID, and send the original message again with updated Session ID
I have Googled this to no avail. The closest thing I could find told me I might accomplish this on the channel layer, but gave no example code at all.
Note that I want to do this in the proxy class, not in code that calls the proxy class. This way callers of the proxy class don't have to worry about automatic re-authentication. I am inheriting from the auto-generated proxy and doing the WCF configuration programmatically.
Any ideas?