Tuesday, January 25, 2011

BPEL States in CUBE_INSTANCE

Very recently, I had a requirement as part of Performance Testing to look up all instances of all BPEL Process which are in a particular state. I was reading the Admin Guide and found the below information. Thought it is worthwhile documenting this information for quick reference:

0 --> initiated
1 --> open and running
2 --> open and suspended
3 --> open and faulted
4 --> closed and pending
5 --> closed and completed
6 --> closed and faulted
7 --> closed and canceled
8 --> closed and aborted
9 --> closed and stale 


Cheers,
-AR

Thursday, January 13, 2011

XSLT for indentifying line feed character

A line feed character is nothing but a new line character. I had a requirement to break a text in one of fields in input xml received by a bpel process. I tried using substring-before function with checking if the value contains '&xa'. However, the soa server does not seem to recognize this.

I understood Substring wouldn't work for line feed characters. The xslt chunk in this post will remove the line feed character and extract the text. Consider the input xml:
<Emp_No>100</Emp_No>
<Emp_Name>SS</Emp_Name>
<Details>First Employee
Second Employee
Third Employee</Details>

This xml has to be transformed to:
<Details1>First Employee</Details1>
<Details2>Second Employee</Details2>
<Details3>Third Employee</Details3>

Use the XSLT below to do the transformation:
<xsl:variable name="Temp">
<xsl:value-of select="translate(/InputXml/Details, '&#xA;', '|')"/>
</xsl:variable>
<Details1>
<xsl:value-of select="substring-before($Temp,'|')"/>
</Details1>
<Details2>
<xsl:value-of select="substring-before(substring-after($Temp,'|'),'|')"/>
</Details2>
<Details3>
<xsl:value-of select="substring-after(substring-after($Temp,'|'),'|')"/>
</Details3>


Cheers,
-AR


Saturday, January 8, 2011

XSLT transformation and Line Breaks

This post details how to add and remove Line Breaks in a XSLT.

Removing Line Breaks in XSLT:

Consider the XML below. Need to remove the line breaks in the input payload:
<test>Line1
Line2</test>


Use the XSLT chunk below to remove the line break from the XML:
<xsl:variable name="Temp">
<xsl:value-of select="translate(/InputXml/test, '&#xA;', '|')"/>
</xsl:variable>
<Line1>
<xsl:value-of select="substring-before($Temp,'|')"/>
</Line1>
<Line2>
<xsl:value-of select="substring-after($Temp,'|')"/>
</Line2>


And then do a concat($Line1,',',$Line2) or as required!

Adding Line Breaks in XSLT:

Adding a line break should not be an issue once the removal of it has been figured out. Lets consider the same XML without line break. We will add line breaks to generate the xml:
<test>Line1
Line2</test>


 Use the XSLT chunk below to add the line break from the XML:
<xsl:stylesheet version="1.0">
<xsl:template match="/">
<OutputXml>
<Details>
<xsl:value-of select="concat(/InputXml/Line1,'&#xA;',/InputXml/Line2)"/>
</Details>
</OutputXml>
</xsl:template>
</xsl:stylesheet>
 

Cheers,
-AR
 

Saturday, January 1, 2011

Happy New Year 2011 !

Dear Visitors,

Wish you all a very happy and prosperous new year ahead.

Happy New Year 2011 !


Thank you all for reading my blog and supporting me. Please continue to do so in the year ahead too!

Cheers,
-AR
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License