Cleaning Up Message Data

After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Use the Filter process step and apply Groovy scripting within your iFlow

Clean Up Message Data: Exercise Overview


While the OData message has been mapped to SOAP there are still some steps required until it is passed on to the final recipients. For one, the message is filtered to select a particular structure of information and special characters have to be substituted to protect the SOAP message from potential errors. Lastly, the SOAP message is created by framing the body with the necessary SOAP message elements.

Task Flow

In this exercise, you will perform the step 28: Prepare more processing steps.


Prerequisites are:

Clean Up Message Data

Task 1: Prepare More Processing Steps


  1. Set a filter.

    1. In the Transformation menu of the iFlow editor, choose Filter and position it adjacent to the previous process step. Connect both as you have learned.

    2. You can optionally change the name of the filter in the General tab of the configuration view that can be expanded from the bottom right of the screen if closed.

  2. Move to the Processing tab and enter/OrderRequestas XPath Expression.

  3. Depending on whether or not you have chosen to work with the pre-configured mappings or your own, your pre-processed message before the filter process step might look different.


    In the case of the provided mapping files, a namespace has to be declared within CI. For this, click anywhere outside of the Integration Process pool box to open the Integration Flow configuration view. Navigate to Runtime Configuration and enter the Namespace Mappingxmlns:ns1=

    This also means that you have to change the XPath Expression in the filter to include the namespace "/ns1:OrderRequest".
    If you have elected to work with your own file, you can skip this step. If an error in your filter occurs when testing the iFlow because of not declaring the namespace, you will be able to see this in the lesson "5.5 Deploying and Testing iFlows" (Set TRACE log level to view message payload) and go back to edit the iFlow then. Hovering over the Namespace Mapping input field will allow you to see the accepted format.

  4. Choose Save on the top right of the screen to secure your progress.

  5. In the Transformation menu of the iFlow editor, choose ScriptGroovy Script and position it adjacent to the previous Filter process step. Connect both elements via drag and drop.

  6. Click onto the Groovy Script element to access its configuration menu. In the General tab, set the Name to Substitute special characters.

  7. As this script is only needed locally within this particular iFlow, you can provide it directly as a resource. This is now shown for demonstration purposes. In reality, it is common practice to make all functions available via a script collection. This feature will be shown in a later exercise.


    For the next step, you need to prepare a file on your local file system or take the .groovy file that you downloaded with the .zip file in the exercise Set Up Your Environment. Name it sub_special_characters.groovy. Enter the following code into this file and save it.

    Code snippet
    import java.util.HashMap;
    def Message processData(Message message) {
          def body = message.getBody(java.lang.String);
            body = body.replaceAll("<", "<")
            body = body.replaceAll(">", ">")
          return message;
    Copy code
    Navigate to theProcessing tab in the configuration view and select Upload from File System. Locate the prepared file sub_special_characters.groovy. Choose OK to proceed.

  8. Select the script resource (path) to familiarize yourself with its workings.

  9. Choose Save to secure your progress.


    You will now build your final SOAP message that is ready to be passed on to its recipients by providing the SOAP body contents.

  10. Select TransformationContent Modifierand position the element next to the previous process step. Connect both elements.

  11. In the configuration menu of the Content Modifier, change its Name to Create SOAP message.

  12. Move on to the Message Body tab and provide the following input:


    Code snippet
    <soap:Body xmlns:m="">
    Copy code
  13. Choose Save to secure your progress.

    At the moment, you can not test this iFlow, because the required End Message event is missing. This will be added in the exercise: Configure Outbound Communication.


    Your message is now ready to be passed on to its final recipients.

Summary of the Lesson: Cleaning Up Message Data and Further Resources


You have successfully transformed the post-mapping message into its final state. The SOAP message is now ready to be sent to the supplier of eCarHero for order fulfillment.

Further Resources

Here you can find more information about Groovy scripting fundamentals.

Save progress to your learning plan by logging in or creating an account

Login or Register