Objective
To demonstrate the capability of XMLSplitter component which takes in XML input from an input device and splits it into multiple parts based on the provided XPath and changing the pattern of output by using a Group operation.
Prerequisites
- Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
- Login to eStudio application
- Understand the basic menus and perspectives (panels) in eStudio application
Scenario
- Create an Event Process with two XMLSplitter components and configure these with Split and Group operations.
- Connect Feeder and Display components on both XMLSplitter components separately.
- Send message using each Feeder component to demonstrate the difference in output that appears in the Display components
Components used
- Two XMLSplitter components
- Two Feeder components
- Two Display components
How it Works
XMLSplitter performs the following two types of operations using Xpath:
- Split: Splits the input XMLs at XPath defined and sends out multiple XMLs, each XML containing one element defined at XPath.
- Group: Splits the input XML at the element whose XPath is specified by the property XPath and then regroups the split XMLs which have the same value for that element into a single message based on the property Select Path.
Setting up the Example
Configuring XMLSplitter component for Split operation
To configure XMLSplitter component, perform the following action in eStudio:
- Add a new Event Process with name 'XMLSplitter_Example'.
- Drag the XMLSplitter component from MOMs category in the Micro Service Palette to the Fiorano Orchestrator.
Figure 1: Adding XMLSplitter component to Fiorano Orchestrator
- Click the XMLSplitter component and do any of the following to rename the component from 'XMLSplitter' to 'XMLSplitter_Split':
- Press F2, change the name and click OK.
Figure 2: Renaming using Keyboard action 'F2'
- Go to Name property under General tab in Properties, change the name and press ENTER.
Figure 3: Renaming using General Properties
- Press F2, change the name and click OK.
Double-click the XMLSplitter_Split component in the Orchestrator to open Configuration Property Sheet (CPS).
Figure 4: XMLSplitter CPS
- In the Interaction Configurations section, select Schema option under Attributes and perform the following actions:
Click the Ellipsis button that appears on the Schema row in Configuration dialog box and paste a valid schema in the Schema editor. Then click the Ellipsis button present in the bottom-right part of the Schema panel to open Root Element dialog box.
Figure 5: Navigating to Root element after pasting Schema
- In the Root Element dialog box, select 'MovieSchema' and click OK. The root element will appear within Select Root Element brackets present next to the Ellipsis button. Click OK in Schema editor.
Figure 6: Selecting Root Element
- As Schema section lists all the namespace prefixes used by XML schema, leave Namespaces section without any changes.
- Click XPath Ellpsis button and perform the following actions in the XPath dialog box:
- Select and delete the default Schema present in the editor.
- Drag the client part under MovieSchema tree from the left panel to the editor and click OK.
Figure 7: Selecting XPath for XMLSplitter_Split
- Retain the Operation value as 'Split' itself, click Next twice and then click Finish.
Configuring XMLSplitter component for Group operation
To configure XMLSplitter component for Group operation, follow the same steps as in "Configuring XMLSplitter component for Group operation" section, change the component name to 'XMLSplitter_Group' (as in Step#2) and perform the following actions in Step#6 (setting XPath):
- Click XPath Ellpsis button and perform the following actions in the XPath dialog box:
- Select and delete the default Schema present in the editor.
- Drag the customer_name part under MovieSchema tree from the left panel to the editor, and click OK.
Figure 8: Selecting XPath for XMLSplitter_Group
- Select the Operation value 'Group'. Select Path attribute appears.
- Click Select Path Ellpsis button, delete the default value and drag client to the editor, and then click OK.
This helps to club the content with same 'customer_name' present under 'client' to consider as one message in the entire data that is sent. - Click Next twice and then click Finish.
Composing the Event Process
To work with the XMLSplitter components, compose the Event Process by performing the below actions:
- Drag two Feeder components and two Display components from Util category in the Micro Service Palette to the xmlSplitter_Example Fiorano Orchestrator.
- Change the names as follows to differentiate from one another:
- Feeder1 to 'Feeder_Split'
- Display1 to 'Display_Split'
- Feeder2 to 'Feeder_Group'
- Display2 to 'Display_Group'
- Connect the components in following order:
- Feeder_Split component output port to XMLSplitter_Split component input port and connect the XMLSplitter_Split component output port to Display_Split component input port.
- Feeder_Group component output port to XMLSplitter_Group component input port and connect the XMLSplitter_Group component output port to Display_Group component input port.
Figure 9: xmlSplitter_Example event process with all the components connected
Configuring Feeder component
To configure the Feeder components, perform the following actions:
- Double-click Feeder_Split component and perform the following actions to configure it:
- In the Message Type Configuration page, retain Output Message Format option as 'XML' and click the Connected Port Schemas button.
- In the Connected ports dialog box, select IN_PORT to enable connection between output port of Feeder_Split and input port of XMLSplitter_Split component. Click OK and then click Next.
Figure 10: Connecting port schemas
- In the Message Details Configuration page, click the Generate Sample button. Click OK in the XSD Sample Generation Dialog window to load sample input.
In the XSD Sample Generation Dialog window, as the max value in No.of Repeatable elements to be generated section is '3', 3 messages gets generated in Display.
Figure 11: Generating sample
- Click Finish to save Feeder_Split configuration.
- Perform the same actions mentioned in the above steps to configure Feeder_Group.
Running the Example
To run the example, perform the following actions in the Orchestrator:
- Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Four windows: Feeder_Split, Display_Split, Feeder_Group and Display_Group get open.
- In both Feeder_Split and Feeder_Group, rename customer_name on all three occurrences as explained below:
- first and second names to 'customer_name_1'
- third to 'customer_name_3'.
- In Feeder_Split, click Send.
Figure 12: Changing customer_name in Feeder_Split and sending the message
- Three messages appear in Display_Split window.
Figure 13: Three messages appearing in Display_Split
- In Feeder_Group, click Send.
Figure 14: Changing customer_name in Feeder_Group and sending the message
- In Display_Group, only two messages appear, because the first and second client entries are grouped by the same customer_name, that is, the clients with "customer_name_1" as customer_name are grouped.
Figure 15: Data with the same customer_name clubbed into one message
Reference
- Download XMLSplitter_Example event process and import it to the Event Process Repository in the Server Explorer in eStudio to understand the configuration used in this example and to execute the working sample.
- Please note that the options used in this example are minimum, which helps you to get an overview of the application. To explore the other options present in the XMLSplitter, Feeder and Display, refer sections: XMLSplitter, Feeder and Display respectively.