receive_reply

receive_reply is an http response message to the receive service request.

For the Simple Messaging API, receive_reply contains the retrieved text message, with no additional packaging, in the http response message body. The response message is encoded with UTF-8 encoding (Content-Type: text/plain;charset=UTF-8).

If the receive service request times out because no message is available, the receive_reply response message body is empty. In this case, the http extension-header's ums.status field is set to the value "404".

For the Simple Messaging API, receive_reply sets the following extension-header fields in the response message:

ums.service: receive_reply
ums.destination:
ums.domain:
ums.mom: openmq
ums.status: 200 (404 if receive request times out because no message is available)

For the XML Messaging API, the retrieved message (JMS BytesMessage) is transformed into a SOAP message and receive_reply places it in the http response message body. The response message is encoded with UTF-8 encoding (Content-Type: text/xml;charset=UTF-8).

If the receive request times out because no message is available, the value of the ums:status attribute in the Service element of the SOAP message header is set to "404".

For the XML Messaging API, receive_reply sets the following attributes of the Service element of the SOAP message header :

<uns:Service
ums:service="receive_reply"
ums:destination=
ums:domain=
ums:mom="openmq"
ums:status="200"/>

For both the Simple Messaging API and the XML Messaging API, a 200 status code indicates the receive service request was successful. All other status codes indicate the receive service request might not be successful.

1. Simple Messaging API Example:

The following is a receive_reply response message that contains the text message "SimpleMsg_0" in the response message body.

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ums.service: receive_reply
ums.destination: simpleMessagingQ
ums.domain: queue
ums.mom: openmq
ums.status: 200
Content-Type: text/plain;charset=UTF-8
Content-Length: 11
Date: Tue, 02 Sep 2008 23:04:05 GMT

SimpleMsg_0

The following is a receive_reply response message for a receive service request that timed out with no message available.

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ums.service: receive_reply
ums.destination: simpleMessagingQ
ums.domain: queue
ums.mom: openmq
ums.status: 404
Content-Type: text/plain;charset=UTF-8
Content-Length: 0
Date: Wed, 03 Sep 2008 17:21:38 GMT

2. XML Messaging API Example:

The following is a receive_reply response message that includes a retrieved SOAP message with Service element attribute values in the header.

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
host: localhost:8888
pragma: no-cache
user-agent: Java/1.6.0_07
cache-control: no-cache
accept: */*; q=.2
soapaction: ""
connection: keep-alive
Content-Type: multipart/related; type="text/xml"; boundary="----=_Part_1_2012387303.1220396786081"
Transfer-Encoding: chunked
Date: Tue, 02 Sep 2008 23:06:25 GMT

27d
------=_Part_1_2012387303.1220396786081
Content-Type: text/xml; charset=utf-8

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header>
              <ums:MessageHeader xmlns:ums="https://mq.dev.java.net/ums" ums:id="1.0" ums:version="1.0">
                    <ums:Service
                    ums:service="receive_reply"
                    ums:destination="XMLmessagingQ"
                    ums:domain="queue"
                    ums:mom="openmq"
                    ums:status="200"/>
              </ums:MessageHeader>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body><bodyvalue>1220396785822</bodyvalue></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------=_Part_1_2012387303.1220396786081
Content-Type: text/plain

attached msg-Tue Sep 02 16:06:26 PDT 2008-1220396786067
------=_Part_1_2012387303.1220396786081--

The following is a receive_reply response message for a receive service request that timed out with no message available to retrieve.

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 03 Sep 2008 17:18:53 GMT

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header>
              <ums:MessageHeader xmlns:ums="https://mq.dev.java.net/ums" ums:id="1.0" ums:version="1.0">
                    <ums:Service
                    ums:destination="XMLmessagingQ"
                    ums:domain="queue"
                    ums:service="receive_reply"
                    ums:mom="openmq"
                    ums:status="404"/>
              </ums:MessageHeader>
       </SOAP-ENV:Header>
       <SOAP-ENV:Body/>
</SOAP-ENV:Envelope>

Back to UMS protocol page.