JMS Response Properties

Applies to ReadyAPI 3.52, last modified on April 25, 2024

To view or change properties and contents of virtual responses, select a response in the Outgoing column of the Setup page of the virtual service editor. You will see the properties on the right of the ReadyAPI window:

Service virtualization and API testing: Properties of outgoing messages (responses)

Click the image to enlarge it.

Properties of JMS responses are organized into the following categories.

Edit

Specifies the response contents. ReadyAPI supports the following message types:

Message Type Description
Text

The response will contain data that you entered into the Editor box. You can include custom properties of your virtual service, as well as data source properties into the response. Use syntax like this:

${#MockService#Virt-Property-Name}

${#MockResponse#Response-Property-Name}

${DataSource-Property-Name}

See Property Expansion in Responses and Data Sources in Virtual Services for complete information.

The Outline view is available only if the contents are XML data.

Map

This type means the response contains name-pair values. To set the response contents, you use Groovy script code like this:

Groovy

message.setString('city', 'Boston')
message.setString('name', 'John')
message.setInt('age', 20)

message is a built-in script object that corresponds to the JMS message. On the client side, you can access the response by enumerator or by name. The order of pairs on the list is undefined.

Bytes

Use this type to add an arbitrary sequence of bytes into the response. This type enables you to literally encode the response body to match specific message formats. You can find the sample code in the script edit box.

Stream

Use this type to add values of simple types (like integers, booleans, strings, and so on) to the response. When this message type is selected, you write data to the response body as you would write them to a stream. For sample code, see the script edit box.

Object

Use this type to create an object in Groovy code and return this object to the response body. The object must implement methods of the java.io.Serializable interface.

Nothing

The response body will be empty.

JMS Destination

Specifies the response destination:

Parameter Description
JMS Server A JMS connection to use.
Send Destination JNDI Name The JNDI name of the topic or queue ReadyAPI sends the response to.

JMS Message Headers

Contains the following properties for changing JMS response headers:

Property Description
CorrelationID Specifies the JMSCorrelationID header value. Typically used to identify the message, which is being replied to.
ReplyTo Specifies the JMSReplyTo header value. Indicates a JMS topic or JMS queue, to which the reply will be sent.

JMS Message Properties

A list of custom headers to be added to the JMS response message. The toolbar above the list contains commands for creating and deleting headers, changing their order, sorting, clearing header values, and loading header values from and saving them to a file.

In custom headers, you can mention data source properties and custom properties of your service. See Property Expansion in Responses.

Note: For customer headers, do not use the names that coincide with JMS header names (see below). The virtual service will overwrite these headers before sending the response to the client:

  • JMSCorrelationID
  • JMSDestination
  • JMSExpiration
  • JMSMessageID
  • JMSPriority
  • JMSReplyTo
  • JMSTimestamp
  • JMSType

Script

A Groovy script code that the virtual service runs before sending the response to the client. You can use this code, for example, to change the response contents or for debug purposes. For information on scripting and available objects, see Virtual Service Scripting.

Data Source

Specifies the data source, whose properties you can use in the response body and headers. See Data Sources in Virtual Services.

See Also

Reference

Highlight search results