Implementing a JMS Service That Writes Attachment to File
This sample reads a GIF file as a binary data on the Consumer (client) and sends the request over JMS transport with attachment configured in Set Context activity. The message format is a RPC-literal element. The SOAP Service receives the message and writes it to the disk. The Service process then reads the file from the disk and sends it back to the SOAP Consumer (client). Finally, the SOAP Consumer (Reference binding) writes the same file to the disk.
Prerequisites
TIBCO Enterprise Message Service must be running.
Copy the ImageInput1.gif file from the TIBCO_HOME\bw\n.n\samples\binding\soap\jms\AttachmentWriteToFile location to the c:\tmp folder on Windows or /tmp on UNIX. This file is used as an input attachment.
In TIBCO EMS administration, create queue.sample before executing the sample.
Procedure
Result
The output.log file at C:\tmp\AttachmentWriteToFile location shows the following information:
Sent file size : 2514 bytes. Received file size : 2514 bytes.
You also see two attachments, printServer.gif and printClient.gif at C:\tmp\AttachmentWriteToFile location.
Understanding the Configuration
SOAP Consumer (Client) sends the binary data using context over JMS transport. Service receives the attachment data and writes the attachment to the disk at location specified in SENT_RECV_FILES_WTF property. Threshold size WRITE_THRESHOLD and WriteToFile Directory is set on both Service and Reference binding.
The Consumer (Client) receives the attachment data from the Service using context and writes the content to disk. Both Service Provider and Consumer (Client) write data to the disk based on the Binding Persistence Configuration.