send
The send service request is an http request message sent to the UMS in accordance with the Simple Messaging API or the XML Messaging API.
The send service request must conform to the following criteria:
Required field/attribute values |
Optional field/attribute values |
---|---|
service=send |
sid |
destination |
user=guest (by default) |
|
password=guest (by default) |
|
domain=queue (by default) |
Notes:
The value of the destination field/attribute is the name of the JMS destination to which the message is to be sent.
The value of the sid field/attribute is a secure token obtained from the previous login_reply response. If an sid value is present, the user and password field/attributes are ignored by the UMS. If an sid value is not present, the user and password field/attributes values can be provided to authenticate with the JMS server, instead of using a login request. Applications use this feature when sending a message only occasionally. Applications would normally use the login request to achieve better performance.
For the Simple Messaging API, the text message to be sent is set in the http request message body. The recommended encoding is UTF-8 (Content-Type: text/plain;charset=UTF-8).
For the XML Messaging API, the SOAP message (and attachments) to be sent is set in the http request message body. The recommended encoding for the SOAP message is UTF-8 ( Content-Type: text/xml;charset=UTF-8).
Service response message: send_reply
1. Simple Messaging API Example:
The following is a send service request message to UMS that sends a text message “SimpleMsg_0”.
POST
/ums/simple?service=send&destination=simpleMessagingQ&sid=7-LTgxMDczMTczNQ==
HTTP/1.1
Content-Type: text/plain;charset=UTF-8
User-Agent:
Java/1.6.0_07
Host: localhost:8888
Accept: text/html,
image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
Content-Length: 11
SimpleMsg_0
2.
XML Messaging API Example:
The following is a send service request message to UMS that sends an XML message with an attachment.
POST /ums/xml HTTP/1.1
Accept:
text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Content-Type: multipart/related; type="text/xml";
boundary="----=_Part_1_2012387303.1220391528720"
Content-Length: 718
SOAPAction: ""
Cache-Control:
no-cache
Pragma: no-cache
User-Agent: Java/1.6.0_07
Host:
localhost:8888
Connection: keep-alive
------=_Part_1_2012387303.1220391528720
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="send"
ums:destination="XMLmessagingQ"
ums:domain="queue"
ums:sid="7-LTgxMDczMTczNQ==
"/>
</ums:MessageHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body><bodyvalue>1220391528456</bodyvalue></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------=_Part_1_2012387303.1220391528720
Content-Type:
text/plain
attached msg-Tue Sep 02 14:38:48 PDT
2008-1220391528714
------=_Part_1_2012387303.1220391528720--
Back
to UMS protocol page.