I am building a service in Windows Workflow Foundation 4.0 in Visual Studio designer mode.
How do I retrieve client IP and request headers in WF, VS Designer mode?
I am building a service in Windows Workflow Foundation 4.0 in Visual Studio designer mode.
How do I retrieve client IP and request headers in WF, VS Designer mode?
The way to get the WCF details from the incoming request is to implement the IReceiveMessageCallback and add that class to the NativeActivityContext.Properties. In the OnReceiveMessage() function you will receive the WCF OperationContext allowing you to retreive any data you like from there.
Seems like what you want to do is put an InvokeMethod activity (this is in the Primitives section of the Toolbox) in your workflow in the designer. There you specify a class type and the method to be called. Inside this method you can call the OperationContext class to get the client address and the request headers like so:
public class Class1 {
public static void SomeMethod() {
EndpointAddress clientAddress = OperationContext.Current.Channel.RemoteAddress;
MessageHeaders headers = OperationContext.Current.RequestContext.RequestMessage.Headers;
// Do something with the address and / or headers...
return;
}
}