Operations on JMS Messaging transactions.
Use this when a user needs to create or select a JMS messaging transaction.
DSL type field is mandatory and must be set to "MESSAGING".
1. General Rules:
- Supported JMS header names: 'MQ9_MQMD_VERSION', 'MQ9_MQMD_REPORT', 'MQ9_MQMD_MESSAGE_TYPE',
'MQ9_MQMD_EXPIRY', 'MQ9_MQMD_FEEDBACK', 'MQ9_MQMD_ENCODING', 'MQ9_MQMD_CHARACTER_SET',
'MQ9_MQMD_PRIORITY', 'MQ9_MQMD_PERSISTENCE', 'MQ9_MQMD_MESSAGE_ID', 'MQ9_MQMD_CORRELATION_ID',
'MQ9_MQMD_BACKOUT_COUNT', 'MQ9_MQMD_USER_ID', 'MQ9_MQMD_ACCOUNTING_TOKEN', 'MQ9_MQMD_APPLICATION_ID',
'MQ9_PUT_APPLICATION_TYPE', 'MQ9_PUT_APPLICATION_NAME', 'MQ9_PUT_DATE_TIME',
'MQ9_MQMD_APPLICATION_ORIGIN_DATA', 'MQ9_MQMD_GROUP_ID', 'MQ9_MQMD_SEQUENCE_NUMBER',
'MQ9_MQMD_OFFSET', 'MQ9_MQMD_FLAGS', 'MQ9_MQMD_ORIGINAL_LENGTH', 'JMS_MESSAGE_ID',
'JMS_CORRELATION_ID', 'JMS_TIMESTAMP', 'JMS_DELIVERY_MODE', 'JMS_REDELIVERED',
'JMS_EXPIRATION', 'JMS_PRIORITY'
- Assign intermediate values with {{#assign "varName"}}{{value}}{{/assign}}.
- Keep JSON objects outside helper calls; helpers should only produce values.
- Do not nest helpers more than 1–2 levels deep.
- Each helper must have exactly one opening and one closing brace; do not add extra # or braces.
- Conditional helpers ({{#eq}}, {{#neq}}, {{#gt}}, {{#lt}}, etc.) must use variable names directly without quotes.
- Use {{else}} only once per conditional; do not use {{#else}} or {{/else}}.
- Avoid repeating the same condition in multiple nested blocks.
- Templates must be valid JSON and readable.
2. Explicit Helper Syntax:
- Opening a block helper: {{#helperName [arguments]}}
Example: {{#assign "userId"}} or {{#eq userId "0"}}
- Closing a block helper: {{/helperName}}
Example: {{/assign}} or {{/eq}}
- Else clause: {{else}} (no #, no /)
Example:
{{#eq userId "0"}}
{ "error": "User not found" }
{{else}}
{ "id": {{userId}}, "name": "John Doe" }
{{/eq}}
- Variable interpolation inside JSON: {{variableName}} only for values
- JSON objects stay outside helpers.
3. Fields that support templates:
- ResponseDsl.content: Base64 encoded response body that can include templates using {{}} syntax.
4. Available helpers (WireMock + Blazemeter custom helpers) — all use {{}} style:
5. LLM-Specific Best Practices:
- Produce one helper per line.
- Do not combine multiple logic operations in a single line.
- Use sequential conditionals for multiple branches instead of deeply nested {{#eq}} blocks.
- Keep templates simple, granular, and maintainable.
- Always follow the explicit helper syntax rules above to prevent extra braces or invalid {{#else}} usage.
6. Example Templates:
# --- Assigning and Joining Values ---
{{#assign 'operation'}}{{join request.method request.url ' '}}{{/assign}}
Result: {{operation}}
# --- Headers ---
All headers: {{request.headers}}
Single header: {{request.headers.JMS_CORRELATION_ID}}
Iterate headers:
{{#each request.headers as |hdr|}}
{{hdr.name}}: {{hdr.value}}
{{/each}}
# --- Body and Body Parsing ---
Raw body: {{request.body}}
Body as JSON: {{jsonPath request.body '$'}}
Body as XML: {{xpath request.body '//element'}}
Extract value using JSONPath:
{{#assign 'price'}}{{jsonPath request.body '$.price'}}{{/assign}}
Extracted price: {{price}}
Extract value using XPath:
{{#assign 'id'}}{{xpath request.body '//order/id/text()'}}{{/assign}}
Extracted ID: {{id}}
# --- Conditional Logic ---
{{#eq request.headers.JMS_CORRELATION_ID '1234'}}
Order is pending
{{else}}
Order status: {{request.headers.STATUS}}
{{/eq}}
# --- Arrays and Ranges ---
{{#assign 'a'}}{{array 'A' 'B' 'C'}}{{/assign}}
Joined: {{arrayJoin ',' a}}
{{#assign 'b'}}{{arrayAdd a 'D' position=1}}{{/assign}}
Added: {{arrayJoin ',' b}}
{{#assign 'c'}}{{arrayRemove b position=2}}{{/assign}}
Removed: {{arrayJoin ',' c}}
{{#each (range 1 3) as |i|}}
Item {{i}}
{{/each}}
# --- String Helpers ---
{{join 'Order' request.path.1 'confirmed'}}
{{replace 'foo-bar' '-' '_'}}
{{upper request.method}}
{{lower user.role}}
{{capitalize 'hello world'}}
{{capitalizeFirst 'wiremock templates'}}
{{defaultIfEmpty request.headers.comment 'none'}}
{{cut 'a,b,c' ','}}
{{slugify 'Hello World!'}}
{{stripTags '<b>bold</b>'}}
{{substring 'abcdef' 2 5}}
{{ljust 'hi' size=5 pad='*'}}
{{rjust 'ok' size=5 pad='-'}}
# --- Date and Time ---
Requested at: {{now}}
Formatted date: {{dateFormat now 'yyyy-MM-dd HH:mm:ss'}}
# --- Math and Size ---
{{#assign 'qty'}}{{jsonPath request.body '$.quantity'}}{{/assign}}
{{#assign 'total'}}{{math price '*' qty}}{{/assign}}
Total: {{total}}
Item count: {{size request.headers.items}}
# --- Regex Extraction ---
{{#assign 'num'}}{{regexExtract request.path.1 '([0-9]+)'}}{{/assign}}
Extracted number: {{num}}
# --- Using "with" Context ---
{{#with request.headers}}
User-Agent: {{User-Agent}}
{{/with}}
# --- Available Request Parts Summary ---
request.headers → Map of headers
request.headers.NAME → Header value(s)
request.properties → Map of headers
request.properties.NAME → Header value(s)
request.body → Raw request body (string)
# --- Available Http Call Action Templates ---
httpcalls.actionName.response.body → Response body of the http call action named "actionName"
httpcalls.actionName.response.statuscode → Status code of the http call action named "actionName"
httpcalls.actionName.request.url → Request URL of the http call action named "actionName"
httpcalls.actionName.request.method → Request method of the http call action named "actionName
httpcalls.actionName.request.headers → Request headers of the http call action named "actionName"
httpcalls.actionName.request.body → Request body of the http call action named "actionName
# --- Available Virtual Service Configuration Templates ---
config.var1 → Value of the virtual service configuration parameter named "var1"
# --- Error Handling Notes ---
If the response returns raw unparsed template text (for example, showing {{request.body}} instead of the actual value), it means the template syntax is **invalid or malformed** and WireMock skipped template parsing.
If the response returns **HTTP 500** with an exception in the WireMock logs, it means the syntax was **parsed correctly but failed during runtime execution** (for example, referencing a non-existent variable, invalid JSONPath, or invalid helper argument).
# --- Important Notes ---
Each helper must always be opened and closed when block form is used (e.g. {{#assign ...}}{{/assign}}, {{#eq ...}}{{/eq}}, {{#each ...}}{{/each}}).
Inline helpers like {{join ...}}, {{replace ...}}, {{upper ...}}, {{jsonPath ...}} do not require closing tags.
Actions:
- read: Read a Transaction. Get the information of a transaction.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace to list transactions from.
id (int): Mandatory. The id of the transaction to get information.
- list: List all transactions.
args(dict): Dictionary with the following required parameters:
workspace_id (int): Mandatory. The id of the workspace to list transactions from.
serviceId (int): Optional. The id of the service to list transactions from. Without this it will list all transactions in the workspace.
virtual_service_id (int): Optional. Filter by virtual service (messaging service mock) id.
limit (int, default=10, valid=[1 to 50]): The number of transactions to list.
offset (int, default=0): Number of transactions to skip.
- validate_template: Validates template used in transaction definition.
args:
template (str): Mandatory. The handlebars template to validate.
- convert_template: Converts template to blazemeter format.
args:
template (str): Mandatory. The handlebars template to validate.
encode (bool, default=True): Whether to encode the converted template to Base64.
- create: Create a new transaction.
Important: before using template in transaction definition validate it and
convert it first using validate_template and convert_template actions.
args(Transaction): A Transaction object with the following fields:
name (str): Mandatory. The name of the transaction.
serviceId (int): Mandatory. The id of the service to create the transaction in.
type (str): Mandatory. The type of the transaction.
dsl (MessagingDsl): Mandatory. The DSL definition of the transaction.
workspace_id (int): Mandatory. The id of the workspace.
delay (int): Optional. Response delay in milliseconds.
description (str): Optional.
tags (list[str]): Optional.
priority (int): Optional. Matching priority 1–2147483647, default 10.
messagingTransactionMappings (dict): Optional. {sourceName, sourceType, destinations: [{destinationName, destinationType}]}.
sampleBody (str): Optional. Example request body for documentation.
- update: Updates a certain transaction.
Important: before using template in transaction definition validate it and
convert it first using validate_template and convert_template actions.
args(Transaction): A Transaction object with the following fields:
id (int): Mandatory. The id of the transaction.
name (str): Mandatory. The new name of the transaction.
type (str): Mandatory. The type of the transaction.
dsl (MessagingDsl): Mandatory. The DSL definition of the transaction.
workspace_id (int): Mandatory. The id of the workspace.
delay (int): Optional. Response delay in milliseconds.
description (str): Optional.
tags (list[str]): Optional.
priority (int): Optional. Matching priority 1–2147483647, default 10.
messagingTransactionMappings (dict): Optional. {sourceName, sourceType, destinations: [{destinationName, destinationType}]}.
sampleBody (str): Optional. Example request body for documentation.
- assign_keystore: Assign keystore asset to the transaction.
args(dict):
id (int): Mandatory. The id of the transaction.
asset_id (int): Mandatory. The id of the keystore asset to assign.
alias (str): Mandatory. The certificate alias to use.
workspace_id (int): Mandatory. The id of the workspace.
- assign_certificate: Assign certificate asset to the transaction.
args(dict):
id (int): Mandatory. The id of the transaction.
asset_id (int): Mandatory. The id of the certificate asset to assign.
workspace_id (int): Mandatory. The id of the workspace.
Transaction Schema (including full MessagingDsl with MessagingRequestDsl and MessagingResponseDsl):
{'$defs': {'AssignedAsset': {'properties': {'assetId': {'description': 'The identifier of the asset', 'title': 'Assetid', 'type': 'integer'}, 'assetUsageType': {'description': 'The usage type of the asset', 'title': 'Assetusagetype', 'type': 'string'}, 'alias': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'The asset certificate alias', 'title': 'Alias'}}, 'required': ['assetId', 'assetUsageType'], 'title': 'AssignedAsset', 'type': 'object'}, 'HttpHeader': {'additionalProperties': True, 'properties': {'name': {'description': 'HTTP header name', 'title': 'Name', 'type': 'string'}, 'value': {'description': 'HTTP header value', 'title': 'Value', 'type': 'string'}}, 'required': ['name', 'value'], 'title': 'HttpHeader', 'type': 'object'}, 'MatcherDsl': {'additionalProperties': True, 'properties': {'key': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': "Matcher key. For URL matchers has static value 'url', for header matchers - header name, for body matchers static name 'body', for query parameter matchers - query parameter name", 'title': 'Key'}, 'matcherName': {'description': "The name of the matcher. Supported values for URL matchers: 'matches_url', 'equals_url'. Supported values for header/query matchers: 'equals', 'equals_insensitive', 'contains', 'matches', 'not_matches', 'absent'. Supported values for body matchers: 'equals', 'equals_insensitive', 'contains', 'matches', 'not_matches', 'absent', 'equals_json', 'equals_xml', 'matches_json', 'matches_xml', 'matches_xml_schema', 'matches_xml_cdata'.", 'title': 'Matchername', 'type': 'string'}, 'matchingValue': {'description': "Value to match against. Not used for 'absent' matcher_name. ", 'title': 'Matchingvalue', 'type': 'string'}, 'optional': {'default': False, 'description': 'If true, the matcher is optional and does not need to be present to match.', 'title': 'Optional', 'type': 'boolean'}, 'namespaces': {'anyOf': [{'items': {'$ref': '#/$defs/XmlMatcherNamespace'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'description': "Namespaces used for XML matching. Only used if matcher_name is one of 'equals_xml', 'matches_xml', 'matches_xml_schema', 'matches_xml_cdata'.", 'title': 'Namespaces'}, 'cdataXpath': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': "CDATA XPath expression used for XML CDATA matching. Only used if matcher_name is 'matches_xml_cdata'.", 'title': 'Cdataxpath'}}, 'required': ['matcherName', 'matchingValue'], 'title': 'MatcherDsl', 'type': 'object'}, 'MessagingDestination': {'properties': {'destinationName': {'description': 'Destination name', 'title': 'Destinationname', 'type': 'string'}, 'destinationType': {'description': 'Destination type: QUEUE, TOPIC, or SUBSCRIPTION', 'title': 'Destinationtype', 'type': 'string'}}, 'required': ['destinationName', 'destinationType'], 'title': 'MessagingDestination', 'type': 'object'}, 'MessagingDsl': {'additionalProperties': True, 'properties': {'requestDsl': {'$ref': '#/$defs/MessagingRequestDsl', 'description': 'DSL for the incoming JMS message matching'}, 'responseDsl': {'$ref': '#/$defs/MessagingResponseDsl', 'description': 'DSL for the outgoing JMS message'}, 'type': {'default': 'MESSAGING', 'description': "The type of the transaction. Supported value is 'MESSAGING'.", 'title': 'Type', 'type': 'string'}}, 'required': ['requestDsl', 'responseDsl'], 'title': 'MessagingDsl', 'type': 'object'}, 'MessagingProperty': {'additionalProperties': True, 'properties': {'name': {'description': 'JMS property name', 'title': 'Name', 'type': 'string'}, 'value': {'description': 'JMS property value', 'title': 'Value', 'type': 'string'}, 'type': {'description': "JMS property type. Supported types are 'BOOLEAN', 'BYTE', 'SHORT', 'INT', 'LONG', 'FLOAT', 'DOUBLE' and 'STRING'.", 'title': 'Type', 'type': 'string'}}, 'required': ['name', 'value', 'type'], 'title': 'MessagingProperty', 'type': 'object'}, 'MessagingRequestDsl': {'additionalProperties': True, 'properties': {'headers': {'anyOf': [{'items': {'$ref': '#/$defs/MatcherDsl'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'List of matchers for the jms headers of the incoming message', 'title': 'Headers'}, 'properties': {'anyOf': [{'items': {'$ref': '#/$defs/MatcherDsl'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'List of matchers for the jms properties of the incoming message', 'title': 'Properties'}, 'body': {'anyOf': [{'items': {'$ref': '#/$defs/MatcherDsl'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'List of matchers for the jms message body', 'title': 'Body'}}, 'title': 'MessagingRequestDsl', 'type': 'object'}, 'MessagingResponseDsl': {'additionalProperties': True, 'properties': {'messageType': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'JMS message type of the response. One of: TEXT_MESSAGE, BYTES_MESSAGE, MAP_MESSAGE, STREAM_MESSAGE, OBJECT_MESSAGE.', 'title': 'Messagetype'}, 'content': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': '', 'description': 'Response body payload. Provide as plain text (e.g. \'{"status":"ok"}\') or as a valid base64 string. Plain text and invalid base64 are auto-encoded by the tool.', 'title': 'Content'}, 'charset': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': 'UTF-8', 'description': 'Character set for the response content (default UTF-8)', 'title': 'Charset'}, 'failoverEnabled': {'anyOf': [{'type': 'boolean'}, {'type': 'null'}], 'default': None, 'description': 'Whether failover is enabled for this response', 'title': 'Failoverenabled'}, 'headers': {'anyOf': [{'items': {'$ref': '#/$defs/HttpHeader'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'JMS headers of the outgoing message', 'title': 'Headers'}, 'properties': {'anyOf': [{'items': {'$ref': '#/$defs/MessagingProperty'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'JMS properties of the outgoing message', 'title': 'Properties'}, 'responseDelay': {'anyOf': [{'$ref': '#/$defs/ResponseDelay'}, {'type': 'null'}], 'default': None, 'description': 'Delay configuration applied to this response'}}, 'title': 'MessagingResponseDsl', 'type': 'object'}, 'MessagingTransactionMapping': {'additionalProperties': True, 'properties': {'sourceName': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'Transaction source name', 'title': 'Sourcename'}, 'sourceType': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'Source type: QUEUE, TOPIC, or SUBSCRIPTION', 'title': 'Sourcetype'}, 'destinations': {'default': [], 'description': 'Transaction destinations', 'items': {'$ref': '#/$defs/MessagingDestination'}, 'title': 'Destinations', 'type': 'array'}}, 'title': 'MessagingTransactionMapping', 'type': 'object'}, 'ResponseDelay': {'additionalProperties': True, 'properties': {'type': {'default': 'FIXED', 'description': 'Delay type: FIXED, LOGNORMAL, or UNIFORM', 'title': 'Type', 'type': 'string'}, 'fixedDelay': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'default': None, 'description': 'Fixed delay in ms (FIXED type)', 'title': 'Fixeddelay'}, 'median': {'anyOf': [{'type': 'number'}, {'type': 'null'}], 'default': None, 'description': 'Median for LOGNORMAL distribution', 'title': 'Median'}, 'sigma': {'anyOf': [{'type': 'number'}, {'type': 'null'}], 'default': None, 'description': 'Sigma for LOGNORMAL distribution', 'title': 'Sigma'}, 'lower': {'anyOf': [{'type': 'number'}, {'type': 'null'}], 'default': None, 'description': 'Lower bound for UNIFORM distribution', 'title': 'Lower'}, 'upper': {'anyOf': [{'type': 'number'}, {'type': 'null'}], 'default': None, 'description': 'Upper bound for UNIFORM distribution', 'title': 'Upper'}}, 'title': 'ResponseDelay', 'type': 'object'}, 'XmlMatcherNamespace': {'properties': {'prefix': {'description': 'XML namespace prefix.', 'title': 'Prefix', 'type': 'string'}, 'uri': {'description': 'XML namespace URI.', 'title': 'Uri', 'type': 'string'}}, 'required': ['prefix', 'uri'], 'title': 'XmlMatcherNamespace', 'type': 'object'}}, 'properties': {'id': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'default': None, 'description': 'The unique identifier of the transaction', 'title': 'Id'}, 'name': {'description': 'The name of the transaction', 'title': 'Name', 'type': 'string'}, 'serviceId': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'default': None, 'description': 'The unique identifier of the service where the transaction belongs', 'title': 'Serviceid'}, 'description': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'Human-readable description', 'title': 'Description'}, 'tags': {'anyOf': [{'items': {'type': 'string'}, 'type': 'array'}, {'type': 'null'}], 'default': [], 'description': 'Tags for filtering and organization', 'title': 'Tags'}, 'priority': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'default': 10, 'description': 'Matching priority (1–2147483647, default 10)', 'title': 'Priority'}, 'dsl': {'$ref': '#/$defs/MessagingDsl', 'description': 'Transaction DSL'}, 'messagingTransactionMappings': {'anyOf': [{'$ref': '#/$defs/MessagingTransactionMapping'}, {'type': 'null'}], 'default': None, 'description': 'Binds this transaction to a source queue/topic/subscription and specifies where responses are sent.'}, 'sampleBody': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'default': None, 'description': 'Example request body for documentation and testing', 'title': 'Samplebody'}, 'assets': {'anyOf': [{'items': {'$ref': '#/$defs/AssignedAsset'}, 'type': 'array'}, {'type': 'null'}], 'default': None, 'description': 'List of assets', 'title': 'Assets'}}, 'required': ['name', 'dsl'], 'title': 'MessagingTransaction', 'type': 'object'}