HTTP GET: IBM MQ bridge for HTTP command

The HTTP GET operation gets a message from an IBM MQ queue. The message remains on the queue. The HTTP GET operation is equivalent to browsing an IBM MQ queue.


Syntax

Request

DELETEGET pathHTTP versionCRLF CRLF general-header CRLF request-header CRLF Entity-header (Request)Path / contextRoot / msg/ queue/queueName@qMgrNametopic/topicName / entity-header (Request)standard entity-header entity-valuex-msg-correlId correlation IDx-msg-msgId message IDx-msg-range rangex-msg-require-headers entity header namex-msg-wait wait time Note:
  1. If a question mark (?) is used it must be substituted with %3f. For example, orange?topic should be specified as orange%3ftopic.
  2. @ qMgrName is only valid on an HTTP POST

Response

HTTP version HTTP Status-Code HTTP Reason-PhraseCRLF CRLF general-header CRLF response-header CRLF Entity-header (Response)CRLFMessageentity-header (Response)standard entity-header entity-valuex-msg-class message typex-msg-correlId correlation IDx-msg-encoding encoding typex-msg-expiry durationx-msg-format message formatx-msg-msgId message IDx-msg-persistence persistencex-msg-priority priority classx-msg-replyTo reply-to queuex-msg-timestamp HTTP-datex-msg-usr user properties


Request parameters


Response parameters


Description

If the HTTP GET request is successful, the response message contains the data retrieved from the IBM MQ queue. The number of bytes in the body of the message is returned in the HTTP Content-Length header. The status code for the HTTP response is set to 200 OK. If x-msg-range is specified as 0, or 0-0, then the status code of the HTTP response is 204 No Content.

If the HTTP GET request is unsuccessful, the response includes an IBM MQ bridge for HTTP error message and an HTTP status code.


HTTP GET example

HTTP GET gets a message from a queue. The message remains on the queue. In IBM MQ terms, HTTP GET is a browse request. You could create an HTTP GET request using a Java client, a browser form, or an AJAX toolkit.

The following figure shows an HTTP request to browse the next message on queue called myQueue.

The request contains the HTTP request header x-msg-wait, which instructs IBM MQ bridge for HTTP how long to wait for a message to arrive on the queue. The request also contains the x-msg-require-headers request header, which specifies that the client is to receive the message correlation ID in the response.

Figure 1. Example of an HTTP GET request
GET /msg/queue/myQueue/ HTTP/1.1
Host: www.example.org
x-msg-wait: 10
x-msg-require-headers: correlID

The following figure shows the response returned to the client. The correlation ID is returned to the client, as requested in x-msg-require-headers of the request.

Figure 2. Example of an HTTP GET response
HTTP/1.1 200 OK
Date: Wed, 2 Jan 2007 22:38:34 GMT
Server: Apache-Coyote/1.1 WMQ-HTTP/1.1 JEE-Bridge/1.1
Content-Length: 50
Content-Type: text/plain; charset=utf-8
x-msg-correlId: 1234567890

Here is my message body that appears on the queue.