Responder correlations determine which messages a Message Responder tool accepts and processes. Various messages sent to the virtual asset URL are routed to specific Message Responder tools (each of which handle different operations) based on the settings here. For example, one Message Responder tool might respond to customer registration messages, another might respond to payment messages, and another might function as a default "catch all" that is used when none of the others match.
To configure responder correlations in CTP:
Transport correlations allow you to specify HTTP Headers, JMS message properties, or MQ message fields within the message that will determine whether or not the message is processed by this particular responder.
To configure a transport correlation:
Request body correlations allow you to specify XPaths within the message that will determine whether or not the message is processed.
To configure request body correlations:
URL path correlations allow you to specify URL paths that will determine whether or not the message is processed. URL path correlations apply to virtual assets that will be accessed over HTTP/HTTPS.
To configure a URL path correlation:
For example, assume that a virtual asset is deployed under the path http://myvirtserver:9080/MyAsset/MyPath
and the path /segment1/segment2/**
is specified in the responder correlation.
The following URLs will match this correlation criteria:
The following URLs will NOT match:
Ant-style wildcards can be used, where * matches zero or more characters and ** matches zero or more directories. Using this format:
Matches | Does Not Match |
---|---|
service/Repository | org/web/service/foo/bar/Entries |
Matches | Does Not Match |
---|---|
org/parasoft/virtualize/tools/service org/parasoft/virtualize/stuff | org/parasoft/somethingelse |
Matches | Does Not Match |
---|---|
org/parasoft/EM/Entries | org/parasoft/EM/foo/bar/Entries |
URL parameter correlations allow you to specify URL parameters that will determine whether or not the message is processed. URL parameters can be repeated (you can have the same parameter set to different values). Any request that contains listed parameters as well as other parameters will correlate. A message that lacks one of the specified parameters will not match. URL parameter correlations apply to virtual assets that will be accessed over HTTP/HTTPS.
To configure a URL parameters correlation:
For example, assume that an asset is deployed under the path http://myvirtserver:9080/MyAsset/MyPath
and the following URL Parameters are specified in a responder:
Parameter Name | Value |
---|---|
param1 | value1 |
param2 | value2 |
The following request URLs will match this correlation criteria:
The following URLs will NOT map to this responder:
HTTP method correlations allow you to specify HTTP methods that will determine whether or not the message is processed. HTTP path correlations apply to virtual assets that will be accessed over HTTP/HTTPS.
To configure an HTTP method correlation:
For example, if GET, POST, and PUT are checked, the responder will match HTTP requests with the method GET, POST, or PUT. HTTP requests with CONNECT, DELETE, HEAD, etc. will not match.
After the above responder correlations are processed, values in the incoming message are compared (matched literally or with an expression) to values in a data source and the responder uses the matching row data to create a response message. If no data source row is found matching the specified incoming message value, then (with the default failover settings) Virtualize will continue searching the responder suite for a responder with matching responder correlation.
For example, the following configures a correlation between the loanAmount value in incoming messages and the Amount column within the ApprovalLists data source:
For each incoming request, the loanAmount value will be matched to one of the rows in the Amount column. The response will then be parameterized with values from other columns for that same row.
When you’re configuring correlations, note that you can enter the name of a data source column, or select from the list of columns available in the data source associated with this tool (selected in the Data Source column at the top of the configuration area).
This shows the selected data source:
This shows the columns available in that data source:
When data source correlation is enabled, Virtualize uses the criteria specified in the data source correlations area to try to match values in the incoming message with data source values. If no data source row matches the specified incoming message value, this is considered to be a data source correlation failure.
When Continue searching for a matching responder if data source correlation fails is enabled (the default setting) and data source correlation fails for this responder, Virtualize will continue searching the responder suite for a responder with matching responder correlation. An error will be reported only if:
If Continue searching for a matching responder if data source correlation fails is disabled and the data source correlation for this responder fails, an error will be reported immediately and Virtualize will stop searching for matching responders.
This area allows you to specify one or more XPaths to run on the incoming messages in order to extract one or more values. The extracted values will be matched with values from the mapped data source columns.
You can enter XPaths directly in the XPath field, or add them using the XPath builder, which is described in Specifying XPaths.
This area applies to assets that are accessed over HTTP/HTTPS. Specify one or more URL parameters to look for in the request URL. The parameter values will be matched with values from the mapped data source columns.
If multiple columns are used for the correlation, the values for each column row must all be either decoded or encoded. If all values are encoded, they must all be encoded in the same way—using either the plus sign or “%20” for spaces, but not both.
Data source correlations can correlate on the absence of a field in the request. For details, see the Virtualize User’s Guide. |
This area applies to assets that are accessed over HTTP/HTTPS. You can configure data source value mappings based on path segment indexes.
For example, assume that:
http://myvirtserver:9080/MyAsset/MyPath
http://myvirtserver:9080/MyAsset/MyPath/[somedynamicvalue]/B/C
If you want to take the value under the [somedynamicvalue]
segment and match it with a data source column, then specify 2 for the URL Path Index. The counting is inclusive of the path segments that are used in the asset deployment path and start from zero.
If you want to match a dynamic value from the URL http://myvirtserver:9080/MyAsset/MyPath/A/[somedynamicvalue]/C
, then use the path index value 3.
If multiple columns are used for the correlation, the values for each column row must all be either decoded or encoded. If all values are encoded, they must all be encoded in the same way—using either the plus sign or “%20” for spaces, but not both.