WebSphere WebSphere Application Server Network Deployment, Version 6.0.x Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Writing a mediation that maps between attachment encoding styles

Use this topic to create a mediation that maps from SOAP Messages with Attachments encoding style to WS-I Attachments Profile Version 1.0 encoding style.

For an introduction to using mediations with the service integration bus, see Learning about mediations. For details of how to install a mediation into WebSphere Application Server and associate it with a bus destination, see Working with mediations.

This topic assumes that you are familiar with using a Java 2 platform, Enterprise Edition (J2EE) session bean development environment such as the Application Server Toolkit (AST) or Rational Application Developer.

The example mediation given in this topic is based upon the WSDL examples that are given in Supporting bound attachments: WSDL examples

You can use a mediation to map from a SOAP Messages with Attachments encoding of a message to WS-I Attachments Profile Version 1.0 encoding. The WSDL definition is the same in both cases, so if you create a mediation that rewrites the Content ID values to match the Version 1.0 conventions then the message is encoded by service integration technologies according to Version 1.0 rules.

To create a mapping mediation, use a Java 2 platform, Enterprise Edition (J2EE) session bean development environment to complete the following steps:

  1. Create an empty mediation handler project. This creates the project, and creates the handler class that implements the handler interface. For detailed instructions on how to do this, see Writing the mediation handler.
  2. Use the mediation pane on the EJB descriptor to define the handler class as a mediation handler.
    Note: When you do this, you specify a name by which the mediation handler list is known. Make a note of this name, for later reference when you create the mediation in the bus.
  3. Add the mapping function to the handler. Before you begin, review Adding mediation function to handler code. Here is an example of mediation handler code that rewrites the Content ID values to match the Version 1.0 conventions:
    int uuidBase = 0;
    DataObject root = SIMessage.getDataGraph().getRootObject();
    List attachments = root.getList(“info/attachments”);
    Iterator entries = attachments.iterator();
    while(entries.hasNext()) {
      DataObject entry = (DataObject) entries.next();
      if(entry.getType().equals(“BoundMIMEAttachmentEntryType”)) {
        String newContentId = entry.getString(“messagePart”) + “=” +
                              Integer.toString(uuidBase++) +
                              “@some.domain”;
      }
    }
    Note: For messages that use a SOAP with attachments reference (swaref) or some other URI mechanism to refer to the attachments, the URI values might also need to be updated to match the new Content ID values. However such mechanisms are usually used to refer to unbound attachments.
    For more information on the service integration technologies classes, including the mediation handler classes, see the generated API information.
  4. Export the mapping mediation enterprise application.
You are now ready to install your mediation into WebSphere Application Server and associate it with a bus destination, as described in Working with mediations.
Related reference
Mapping of SDO data graphs for Web services messages

Task topic

Terms of Use | Feedback

Last updated: 5 Oct 2005
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.pmc.nd.doc\tasks\tjw_mediation_attach.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)