JMS Response Properties

Applies to ReadyAPI 3.7, last modified on April 08, 2021

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 DataSources 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 Provider A list of preconfigured JMS providers.
Initial Context Class The class that will be used to create an InitialContext object. You can find its name in the JMS provider documentation.
Provider URL The URL of the JMS server you use.
Connection Factory JNDI Name The name of the ConnectionFactory object you use to connect to the JMS broker.
Receive Destination JNDI Name The JNDI name of the topic or queue that ReadyAPI emulates. Requests to it will be redirected to the virtual service.
Send Destination JNDI Name The JNDI name of the topic or queue ReadyAPI sends the response to by default. It can also be configured in the response editor.
User Name The name of the user who connects to JMS.
Password The user's password.
Additional JNDI Properties Additional connection properties for the JNDI server. Specific usage depends on the JMS provider.
  • Use ReplyTo from incoming messages – The virtual service will send the response to the destination set by the ReplyTo property of the incoming request.

  • JMS Destination – The virtual service will send the response to the specified JMS topic or queue:

    Property Description
    Session The sessions of the destination topic or queue.
    Destination The name of the destination JMS queue or topic.

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.

DataSource

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

See Also

Reference

Highlight search results