The QTurn demonstration utility is provided in the sample directory of IBM(R) WebSphere(R) Business Integration for Healthcare to assist with demonstration and testing of the solution. The QTurn utility is a simple line command JavaTM program that receives and sends WebSphere MQ messages to simulate a system application that is unavailable at demonstration or test time. The QTurn utility can be run on Microsoft(R) Windows(R) or AIX operating systems.
The QTurn utility can be used in three basic ways:
Although the QTurn utility was specifically created to help demonstrate and test the WebSphere Business Integration for Healthcare industry solution, it is configurable and can be used in other scenarios, with the following limitations:
The following table lists the files contained in the QTurn utility:
File name | Description |
---|---|
qturn.jar | QTurn application code |
qturn.bat | Sample BAT file that invokes QTurn (Windows only) |
test1 | Sample script file that invokes QTurn (AIX only) |
valuetransfers | Sample of an optional transfer file specifying multiple value transfers |
Complete the steps that are appropriate for your operating system.
QTurn does not use an installer for the Windows operating system. It consists of a Java JAR file and associated BAT file, along with sample input files. The following steps place these files in a directory named QTurn, but you can rename the directory and store your files in a different folder as long as the path specification is correct during the command line invocation.
QTurn does not use an installer for AIX. It consists of a Java JAR file and associated script file, along with sample input files. The following steps place these files in a directory named QTurn, but you can rename the directory and store your files in a different folder as long as the path specification is correct during the command line invocation.
$LIBPATH:/usr/mqm/java/lib
/usr/mqm/java/lib/com.ibm.mq.jar:/usr/mqm/java/lib/connector.jar: /usr/mqm/java/lib/com.ibm.mqjms.jar: /usr/mqm/java/lib/jms.jar: /usr/mqm/java/lib/jta.jar: /usr/mqm/java/lib/jndi.jar: /usr/mqm/java/lib/providerutil.jar: /usr/mqm/java/lib/fscontext.jar: /usr/mqm/java/lib/ldap.jar: /usr/mqm/java/lib/com.ibm.mqbind.jar:$CLASSPATH
/usr/mqm/java/lib
Qturn is invoked from the command line. Due to the number of options, it is useful to make either a BAT or script files to save your command options. The following table lists the available options and provides a description of each:
Command | Description |
---|---|
-iqmgr | Input queue manager where requests are received (Required). |
-iq | Input queue where requests are received (Required). |
-oqmgr | Output queue manager where responses are sent. If not specified, the -iqmgr value is used. |
-oq | Output queue where responses are sent. If not specified, no response is sent. |
-of | Path and name of the file to send as a response. If not specified, no response is sent. Path can be fully qualified or relative to current execution directory. |
-v | Verbose mode flag, prints the in and out messages to System.out. Default is off. |
-insert1 | If input is XML, the name of the XML tag whose value is to be moved into the response placeholder "INSERT1". If not specified, the default XML tag is BHT_Reference_Identification. For non-XML, this is a number indicating the delimited position to be moved into the response placeholder "INSERT1". If not specified, the default non-XML delimiter position number is 9 (between 9 and 10. Delimiter positions start with 1). |
-h | WebSphere MQ server hostname (WebSphere MQ Client mode only) |
-c | WebSphere MQ server connection channel (WebSphere MQ Client mode only). |
-p | WebSphere MQ server port, default is 1414 (WebSphere MQ Client mode only). |
-d | Delimiter character, default is "|". Multiple char delimiters not supported. |
-rt | Target text to replace, default is "INSERT1". |
-tf | Path and name of the transfer file specifying source/target pairs. When a transfer file is specified, the default replace action and –insert1 and –rt options are ignored. |
To invoke the QTurn utility, double-click the qturn.bat file or enter the following command at a command line:
java -classpath "qturn.jar;%Classpath%" com.ibm.wbihc.samples.utils.QTurn -v -iqmgr QTURN -iq IN -oqmgr QTURN -oq OUT -of respfile
To invoke the QTurn utility, run the test1 file or enter the following at a command line:
java -classpath qturn.jar:$CLASSPATH com.ibm.wbihc.samples.utils.QTurn -v -iqmgr cltins06.queue.manager -iq QTURN_IN -oq QTURN_REPLY -of respfile
Regardless of the operating system, you must supply a response file, respfile, to serve as the body of the MQ response. The single default value transfer will be attempted. If you do not put a place holder in the respfile, no replacement will occur and the message will be sent unchanged.
Once the Qturn application determines that the input file is XML, only XML value transfers are attempted. The default XML transfer is to take the value of the element, BHT_Reference_Identification, in the input file and place it in the output file wherever the INSERT1 placeholder is found. This action does not require options to be specified.
The default transfer can be altered in the following two ways:
Note: The specified XML tag must be a simple element with a simple value. XML attributes are not supported. XML element name tags that can be resolved to integers are not supported.
Once the Qturn application determines that the input file is not XML, it assumes it to be character-delimited and attempts character-delimited value transfers. The default character-delimited transfer is to take the value between the 9th and 10th delimiter in the input file and place it in the output file wherever the INSERT1 placeholder is found. This action does not require options to be specified.
The default transfer can be altered in two ways:
Included with the utility is a sample transfer file, valuetransfers, that enables multiple transfers. This file uses a standard properties file format to specify the source value location in the input file and the target placeholder in the output file. It is specified in the qturn line command with the -tf option.
The key values on the left can be one of two types: XML element name (attributes of which are not supported, nor are element names that resolve to integers) or character delimiter position (value found after the specified integer position, starting at 1). A mixture of key value types is not supported as the input file is expected to be of one format or the other.
The sample values listed below are delimiter positions. The values on the right are the literal placeholders in the output file. They will be replaced with the values located according to the associated key value. These placeholder values can be of a different length than the expected actual value and need not resemble the values in this sample.
If multiple occurrences of the same placeholder value occur in the output file, they are all replaced with the specified value from the input file.
Note: Use of the -tf option prevents the single value transfer that is offered with the line command options or default. The -insert1 and -rt options, if used, will be ignored.
The supplied sample contains the following entries:
Since the default transfer is disabled when a transfer file is used, the entries below show how the two default activities would be specified in a transfer file.