Sending and receiving messages via JMS

As of Tricentis Tosca 12.2, the Webservice Engine 3.0 is no longer supported. By default, you cannot create WSE TestCases in API Scan.

For information on how to re-enable scanning WSE TestCases in API Scan, see chapter "Web service".

The Tosca Webservice Engine allows messages to be steered via the programming interface JMS for specific JMS providers.

Tosca supports the following JMS providers: ActiveMQ, Websphere MQ, RabbitMQ and Tibco EMS (see chapter "System Requirements for Tricentis Tosca 14.1 STS").

The JMS provider RabbitMQ and Tibco EMS support communication via SSL.

All Modules in this chapter can be used with the above-mentioned JMS providers. Use the module according to the webservice you want to communicate with. In this chapter we use the placeholder <JMS provider> instead of the provider.

Use the Module Communicate with <JMS provider> from the Standard subset for defining the information required.

The Communicate with <JMS provider> Module is located at Standard modules->TBox XEngines->API.

Steering with WebSphere MQ

An installation of a WebSphere Client is required to be able to use Websphere MQ along with the Tosca Webservice Engine. The needed version is given in chapter "System Requirements for Tricentis Tosca 14.1 STS".

The MORFH2 header can be disabled for communications that use applications which do not support JMS (see chapter "Enable JMS").

Steering with Tibco EMS

An installation of the Tibco EMS Client is required to be able to use Tibco EMS along with the Tosca Webservice Engine. The needed version is given in chapter "System Requirements for Tricentis Tosca 14.1 STS".

Queue

When messages are either sent or received, the system always retrieves the message which is ranked first within the queue (first in - first out). Once a message has been retrieved it is regarded as consumed.

  1. Create a TestStep from the Module Communicate with <JMS provider>.

  2. Specify the name and the port of the queue for the TeststepValue Host.

  3. For the WebSphere MQ provider, specify the Channel and Manager of the queue additionally.

  4. Define the request or response contents as described in chapter "Creating Webservice TestCases".

JMS queue example

Register and send system (Topic)

When messages are either sent or received, the system addresses a specific topic. Messages can be retrieved by more than one users (subscribers).

  1. Create a TestStep from the Module Communicate with <JMS provider>.

  2. Specify the name and the port of the JMS Message Broker that transfers the messages for the TeststepValue Host.

  3. For the WebSphere MQ provider, specify the Channel and Manager of the queue additionally.

  4. Select the value Topic for the TestStepValue Endpoint->Type.

  5. Define the subscription from where the message is to be received under Endpoint->Subscription and the topic name under Endpoint->Name for received messages. For further details on how to create subscriptions, please refer to chapter "Creating subscriptions".

  6. Define the request or response contents as described in chapter "Creating Webservice TestCases".

JMS topic example

Creating subscriptions

Messages that should be received need a subscription to be created beforehand.

  1. Use the Module Create Subscription to create a TestStep.

  2. Define the name and port of the JMS Message Broker which sends the message in the TestStepValue Host.

  3. For the WebSphere MQ provider, specify the Channel and Manager of the queue additionally.

  4. Enter the topic participant under Subscription.

  5. Specify the name of the topic which you would like to subscribe in the TestStepValue Topic.

Deleting subscriptions

Subscriptions are deleted via the Module Remove Subscription.

  1. Use the Module Remove Subscription to create a TestStep.

  2. Define the name and port of the WebSphere Message Broker which sends the message in the TestStepValue Host.

  3. For the WebSphere MQ provider, specify the Channel and Manager of the queue additionally.

  4. Enter the topic participant under Subscription.

  5. Specify the name of the topic from which you would like to unsubscribe in the TestStepValue Topic.

Header properties

The following headers are available by default in the Header ModuleAttribute of the Module Communicate with Web service in order to identify or send messages:

Header name

Description

DeliveryMode

Possible values: Persistent and NonPersistent. Messages which include the value NonPersistent are deleted when the JMS Message Brokers is relaunched.

UserId

Set this property if you want to know the identity of the user who published a message. The value for UserId must be equal to the name of the user used to open the connection.

ContentType

Displays the content type.

Expiration

Time period after which a messages expires. All positive integers can be used as values.

Priority

Defines the priority for a message. Possible values: Lowest, VeryLow, Low, BelowNormal, Normal, AboveNormal, High, VeryHigh and Highest.

Valid values for RabbitMQ are all numbers from 0 to 255. The value 0 indicates the lowest priority, and 255 the highest priority.

MessageID

If Enabled is defined as a value, the MessageID is automatically set when messages are sent.

You can enter a string of your choice for RabbitMQ.

Timestamp

If the value is set to Enabled, a timestamp is automatically set when messages are sent.

You can specify any Unix timestamps in UTC format in seconds starting from 01/01/1970 for RabbitMQ.

CorrelationID

Identification which is automatically assigned to a message when this is sent.

ReplyTo

The target address for a response message.

Syntax: <recipient type>://<recipient name>

Possible values for <recipient type> are as follows: queue, topic, tempqueue or temptopic.

Example: queue://my_queue_or topic://my_topic.

Type

Message type in the repository of a provider.

GroupID

Identification of the message group the message is part of.

GroupSequence

Defines the sequence for the messages to be sent. All positive integers can be used as values.

ApplicationId

This header is solely available to the RabbitMQ provider. It represents the application. You can define any strings as value.

Redelivered

Defines whether a message is returned. Possible values: true or false.

DeliveryCount

Specifies the number of attempts for sending a message. This is automatically set.

ProducerTXID

This header is available for the ActiveMQ provider only. Identification of the transaction which is automatically set when the message is sent.

The following headers are supported by the providers ActiveMQ, WebSphere MQ and Tibco EMS: GroupID, GroupSequence und DeliveryCount.

Header

Customer-specific header properties can be defined beneath the TestStepValue Properties: simply rename the TestStepValue Name as you like.

Customized header properties

Authentication

An authentication is required if the access to a queue or to a topic is restricted. Authentications are described in greater detail in chapter "HTTP authentication".

If the JMS provider WebSphereMQ is applied, the system will use the credentials of the user that is logged onto the OS for authentication.

If you want to enable SSL communication for Tibco EMS, select the TestStep which uses the Communicate with Tibco EMS Module and specify the server certificate name under SSL Configuration -> Target Host Name. Make sure that the ROOT-CA-certificate for this certificate is available in the trusted store.

Peeking

You can retrieve messages from topics or queues without consuming them. For this purpose define the TestStepValue Peeking and set its value to True.

Peeking

Logging

Log files are managed as described in chapter "Logging".

The LogLevel can additionally be modified via the test configuration parameter WebserviceEngineLogLevel. Possible values: Only MessageBody or Full. The default value is Full.

Logging

Sending plain text as a message

Tosca allows you to send a simple string as a message to a web service.

  1. Define the specialization Plain Text for the TestStepValues Request or Response.

  2. Enter the string to be sent as a message into the Value TestStepValue.

Sending simple text as a message