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






- If a question mark (?) is used it must be substituted with %3f. For example, orange?topic should be specified as orange%3ftopic.
- @ qMgrName is only valid on an HTTP POST
Response




Request parameters
- Path
- See URI Format.
- HTTP version
- HTTP version; for example, HTTP/1.1
- general-header
- See HTTP/1.1 - 4.5 General Header Fields.
- request-header
- See HTTP/1.1 - 5.3 Request Header Fields. The Host field is mandatory on an HTTP/1.1 request. It is often automatically inserted by the tool we use to create a client request.
- entity-header (Request)
- See HTTP/1.1 - 7.1 Entity Header Fields. One of the entity headers listed in the Request syntax diagram.
Response parameters
- Path
- See URI Format.
- HTTP version
- HTTP version; for example, HTTP/1.1
- general-header
- See HTTP/1.1 - 4.5 General Header Fields.
- response-header
- See HTTP/1.1 - 6.2 Response Header Fields.
- entity-header (Response)
- See HTTP/1.1 - 7.1 Entity Header Fields. One of the entity or response headers listed in the Response syntax diagram. The Content-Length is always present in a response. It is set to zero if there is no message body.
- Message
- Message body.
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.
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.
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.