HTTP POST: IBM MQ bridge for HTTP command
The HTTP POST operation puts a message on an IBM MQ queue, or publishes a message to a topic.
Syntax
Request
Pathentity-header (Request) Note:- 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
entity-header (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. The Content-Length and Content-Type should be inserted in a request, and are often inserted automatically by the tool we use to create a client request. The Content-Type must match the type defined in the x-msg-class custom entity-header, if it is specified.
- Message
- Message to put onto the queue, or publication to post to a topic.
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.
Description
If no x-msg-usr header is included, and message class is BYTES or TEXT, the message put on the queue does not have an MQRFH2.
Use HTTP entity and request headers in the HTTP POST request to set the properties of the message that is put onto the queue. We can also use x-msg-require-headers to request which headers are returned in the response message.
If the HTTP POST request is successful, the entity of the response message is empty and its Content-Length is zero. The HTTP status code is 200 OK.
If the HTTP POST request is unsuccessful, the response includes an IBM MQ bridge for HTTP error message and an HTTP status code. The IBM MQ message is not put on the queue or topic.
HTTP POST example
HTTP POST puts a message to a queue, or a publication to a topic. The HTTPPOST Java sample is an example an HTTP POST request of a message to a queue. Instead of using Java, you could create an HTTP POST request using a browser form, or an AJAX toolkit instead.
The following figure shows an HTTP request to put a message on a queue called myQueue. This request contains the HTTP header x-msg-correlId to set the correlation ID of the IBM MQ message.
The following figure shows the response sent back to the client. There is no response content.