Monday, May 26, 2008

FINS Industry XML Query Service – Parsing XML Hierarchy

This business service is quite useful if you are into Siebel EAI. Lot of times we have requirement, to retrieve specific Tag or attribute values from XML hierarchy that we have obtained.
As usual there are always two methods to do everything in Siebel
Scripting (Quite inefficient and most used)
Vanilla BS or Vanilla functionalities (Quote efficient and least used)
So, here also you can achieve the above requirement in two ways.
Scripting i.e. you write a custom business service to parse the XML and retrieve the values and use them.
FINS Industry XML Query Service: Use this vanilla business service to retrieve the values.
In this post I will tell you step by step procedure to use FINS Industry XML Query Service in a Workflow as I was not able to find out much about it through bookshelf.
In the example below I assume that your workflow has XMLHierarchy Ready to be passed as input in a process property called XMLH. How to get XML Hierarchy is subject to a different post.
Add a step of type business service in the workflow
Provide the following input arguments for that stepBusiness Service Name: FINS Industry XML Query ServiceBusiness Service Method: Execute

Now Right Click this step and choose Input Arguments
Create a New Record
Provide the Following values to the Input ArgumentInput Argument: XMLHierarchyType: Process PropertyProperty Name: XMLH (This is the process property that will contain your XML Hierarchy queried from pervious steps)
Create a another New Record
Provide the Following input argumentsInput Argument: TestProcessProperty (Name of the process property in which you want to store the value)Type: LiteralValue: ./*/TestTag (You have to give the element path in XPath Notation)Add more input arguments if you want to retrieve more element values just change the path according to their place in the XML hierarchy
Right click the step again and choose Output Argument as shown below
Provide the following valuesProperty Name: TestProcessPropertyValue: Output ArgumentOutput Argument: TestProcessPropertyYou will have to do this for every input argument that you have mentioned to reterive the value
The Above mentioned path would work if the XML hierarchy is as following
TestValue
How to find out the path of an element?This is general tip that you can use to find out the path for the particular element.
Simulate the workflow
Open your watch window
Go the process property which contains your XML HierarchyAdd “./” for the first + sign you click
add */ for every subsequent + sign you click till the time you see the element that you want to retrieve.
This will roughly give you your path.
We will discuss more about XPath Notation in next post of this series

2 comments:

navin rai said...

how to read xml tag attribute value using FINS Industry XML Service? In your blog i don't see any section for that. I tried with normal approach given by you but it only works for tag values.

Ak said...

Hi, How we can get tag which are having same name but present in different IC?