Sending and Receiving a SOAP Unbound Attachment

A client sends Text and GIF files as attachments for unbound attachments to the server process. The Server process receives these attachments and returns them as its response. The Client process captures the sent and received attachments size.

Prerequisites

Copy the Attachment.txt and Client.gif files from TIBCO_HOME\bw\n.n\samples\binding\soap\http\UnboundAttachments to the directory given for the AttachmentBaseDir property.

Note: It is an Unbound Attachment when no part of the Input or Output WSDL message is mapped to an attachment. In the concrete WSDL there is no indication whether an attachment is required in the Input or Output. You can map an attachment in the mimePart config at Binding level only at design time.

Procedure

  1. In the samples directory, select binding > soap > HTTP > UnboundAttachments and double-click tibco.bw.sample.binding.soap.http.UnboundAttachments. For more information, see Accessing Samples.
  2. In the Project Explorerview, expand the tibco.bw.sample.binding.soap.http.UnboundAttachments project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Click Run > Debug Configurations.
  5. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  6. 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.binding.soap.http.UnboundAttachments.application.
  7. Click Debug.
    This executes the sample in Debug mode.
  8. In TIBCO Business Studio™ for BusinessWorks™, click the Terminate icon to stop the process.

Result

An UnboundAttachments directory is created and output.log file is generated with the following content written to it:

Sent binary file size : 2878 bytes. Received binary file size : 2878 bytes. Sent text file size : 35 Received text file size : 35

Understanding the Configuration

The ServerProcess implements the getsetAttachments operation along with Context activities. It receives the client request that has WSDL message parts defined as Element of Complex type. Binary and Text attachments are retrieved using Get Context activity. Service reply mechanism sends back the same attachments to the ClientProcess using theSet Context activity.

The ClientProcess invokes the ServerProcess with input attachments (Binary and Text) using Set Context activity. The Consumer (Client) reads the input files and sends them to the Producer (Server) process using the context mechanism. Attachments received from the server through Get Context activity are written to disk on the client side.

Finally, the Sent and Received file size information for Binary and Text attachments is written at the location specified in the OUTPUT_FILE module property.

These attachments' size matches and also depicts that attachments can be sent or received between the Producer and Consumer where they are defined using the context mechanism outside of WSDL definition.