The following configuration shows how to share a session and reuse the session cookie container between two activities.
In this scenario, Cora SeQuence sends two calls to a service. The first call gets an authentication token and the second call performs the action.
You need to set up one HTTP Consumer that captures the returned token (cookie) and then pushes it to a second HTTP Consumer, which sends additional calls to get the data.
NOTE
The following procedures show only the settings relevant for reusing cookies between activities.
For more details on setting up HTTP Service activities, see this article.
Setting up the HTTP Consumer that captures the token
- On the HTTP Consumer Details screen, click Advanced Options.
- Set the type of the
HttpMessageHandler
node to webRequestHandler.
- Set
UseCookies
to True.
- Set the value of
InstanceMode
to "PerSession".
- In the HTTP Consumer Bindings screen, clear the IsNull checkbox for the following nodes:
HttpRequestMessage
SessionOptions
- Depending on the persistence mode, configure one of the following options for the session
Id
:- Default mode: Set it to the workflow instance ID as string
- InMemory mode: Set it to a variable with a predefined random value. For example,
Guid.NewGuid().ToString("N")
- Change
SessionCloseBehavior
to "KeepOpen".
Setting up the HTTP Consumer that accesses the data
- On the HTTP Consumer Bindings screen, select the clear the
HttpRequestMessage
node, and clear the IsNull checkbox.
- Select the
SessionOptions
node, and clear the IsNull checkbox.
- Set the SessionOptions properties, as follows:
- Session
Id
: workflow instance ID as string SessionOpenBehavior
: "Reuse"SessionCloseBehavior
: "Close"
- Session
NOTE
The session ID must match the session ID of the first HTTP Consumer.