Context Parameters

A context parameter is a key-value pair passed to a service operation invocation. The values are populated by bindings, which map transport and binding headers to context parameters. Context parameters allow component developers to access transport and binding metadata that could affect the execution of an operation but which is not passed in the input, output, and fault messages defined by an abstract WSDL file.

A service may be supported on multiple types of transport bindings; each binding protocol specifies its own headers. For example, HTTP supports a body and headers that specify metadata that can be mapped to context parameters. The SOAP similarly defines a body and headers that are different than HTTP headers. The JMS protocol defines headers and allows developers to define application-specific properties. Typically, a client invoking a service will set some headers. For example, browsers usually set the HTTP Locale and Referrer headers.

Component implementations can read and set the values of context parameters and the values can be used to control service operation logic. The operation behavior thus changes according to the metadata. For example, consider a service that pays the agent that referred a customer to a website. To track the referrer on a SOAP/HTTP binding, you would specify a mapping from the HTTP Referrer header to a context parameter. If the service has a JMS binding, you would specify a mapping from a JMS message property named referencedBy to the same context parameter. When the incoming message is SOAP/HTTP, the HTTP Referrer header is copied into the context parameter and when a JMS message arrives, the referencedBy property is copied into the context parameter. The following table lists the header sources for each binding type.

Header Source
Binding Type Header Source
SOAP/HTTP HTTP Transport Header, HTTP Context, TCP Context, SOAP Header, SOAP Fault
SOAP/JMS JMS Header, JMS Application Properties, SOAP Fault, SOAP Header
JMS JMS Header, JMS Application Properties
Note: In the TIBCO ActiveMatrix platform, the context parameter key com.tibco.security.userinformation is used to communicate security context. It can be retrieved by a component from requestContext. However, when invoking a reference this context parameter may be overwritten by a policy agent before the SOAP binding maps it to a HTTP Transport Header or JMS application property. Therefore, you cannot set this context parameter in a component before invoking a reference.
The following sections list the headers available in each header source. The tables in each section list which headers are available in service or reference bindings.
  • From: XXX Binding To: Context applies to inbound messages received on either a service ("in" part of "in-out" MEP) or a reference ("out|fault" part of "in-out" MEP)
  • From: Context To: XXX Binding applies to outbound messages sent from either a service ("out|fault" part of "in-out" MEP) or a reference ("in" part of "in-out" MEP)

HTTP Context

From: SOAP/HTTP Binding (WS-A = OFF) To: Context
Service HTTP-Method, HTTP-FileSpec, HTTP-Version
Reference HTTP-Status-Code, HTTP-Status-Message
From: SOAP/HTTP Binding (WS-A = ON) To: Context
Service HTTP-Method, HTTP-FileSpec, HTTP-Version
Reference None

TCP Context

From: SOAP/HTTP Binding To: Context
Service Local-TCP-Host, Local-TCP-Port, Remote-TCP-Host, Remote-TCP-Port
Reference None

SOAP Fault

From: SOAP Binding (For Declared Faults) To: Context
Service None
Reference Role, Code
From: Context To: SOAP Binding (For Declared Faults)
Service Role, Code
Reference None

JMS Header

From: SOAP/JMS Binding To: Context
Service JMSCorrelationID, JMSDeliveryMode, JMSMessageID, JMSType
Reference None
From: Context To: SOAP/JMS Binding
Service None
Reference JMSCorrelationID, JMSDeliveryMode, JMSType
For information on how to create context parameters, see Composite Development.
The first time you add a context parameter to a service or reference wired to a Spring component, an error badge will be added to the Spring component and the error will be reported in the Problems view. When you resolve the error by updating the implementation, the following is added to the abstract component implementation:
import org.osoa.sca.annotations.Context;
import com.tibco.amf.platform.runtime.extension.context.ComponentContext;
	/**
	 *	Use this property to access the context parameters.
	 *	Context parameters for this component are:
	 *    parameterName  :  DIRECTION
	 */
	@Context
	public ComponentContext componentContext;
For each successive parameter, no error badge is added to the component. To update the list of context parameters in the comment, update the component implementation.

Methods defined on ComponentContext allow you to retrieve and set a RequestContext, which in turn has methods for retrieving and setting the context parameters.