Genpact Cora Knowledge Center

Support

Reusing Cookies in HTTP Consumers

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

  1. On the HTTP Consumer Details screen, click Advanced Options.
  2. Set the type of the HttpMessageHandler node to webRequestHandler.
     
  3. Set UseCookies to True.
     
  4. Set the value of InstanceMode to "PerSession".
     
  5. In the HTTP Consumer Bindings screen, clear the IsNull checkbox for the following nodes:
    1. HttpRequestMessage
    2. SessionOptions
  6. 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")
  7. Change SessionCloseBehavior to "KeepOpen".

Setting up the HTTP Consumer that accesses the data

  1. On the HTTP Consumer Bindings screen, select the clear the HttpRequestMessage node, and clear the IsNull checkbox.
     
  2. Select the SessionOptions node, and clear the IsNull checkbox.
     
  3. Set the SessionOptions properties, as follows:
    1. Session Id: workflow instance ID as string
    2. SessionOpenBehavior: "Reuse"
    3. SessionCloseBehavior: "Close" 

NOTE
The session ID must match the session ID of the first HTTP Consumer.