HTTP Sending and Receiving MIMEAttachments

This sample shows how the HTTP Receiver, HTTP Response, and HTTP Request activities can be used to send MIME attachments over HTTP.

The sample proceeds as follows:

  • The Client process sends a HTTP Request with three attachments.
  • The Server process responds with a HTTP Response with two attachments.

Prerequisites

Copy the TIBCO_HOME\bw\n.n\samples\palette\http\MIMEAttachment\attachment1.gif file to the c:\tmp folder on Windows or the /tmp folder on UNIX.

Procedure

  1. In the samples directory, select palette > http > MIMEAttachment and double-click tibco.bw.sample.palette.http.MIMEAttachment. For more information, see Accessing Samples.
  2. In Project Explorer expand the tibco.bw.sample.palette.http.MIMEAttachment project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Fully expand the Processes directory and double-click Client.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  7. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco.bw.sample.palette.http.MIMEAttachment.application.
  8. Click Debug.
    This runs the sample in the Debug mode.
  9. Click the Terminate icon to stop the process.

Result

The mimeattachment.log output file at C:\tmp\MIMEAttachment should have the following content:

[Server] Received attachment of content-type: image/gif

[Server] Received attachment of content-type: text/plain

[Server] Received attachment of content-type: image/gif

Reply sent with attachment

[Client] Received attachment of content-type=: text/plain

[Client] Received attachment of content-type=: image/gif

Also, the large_files folder at C:\tmp\MIMEAttachment\download should have four files generated with the attachment content received from the client side.

Understanding the Configuration

The client process sends a HTTP Request with following three attachments:

  • textContent
  • binaryContent
  • fileName

The server process responds with a HTTP Response with following two attachments:

  • textContent
  • binaryContent