Suppose you only want an implementation and do not care much about the explanation, you can skip the 'Some basics' section, only execute the commands in bold in the 'Lets get started!' section and the steps in the 'WebLogic and SOA Suite' section. Do take into consideration any existing SSL related configuration on your own system.
Articles containing tips, tricks and nice to knows related to IT stuff I find interesting. Also serves as online memory.
Showing posts with label soa suite. Show all posts
Showing posts with label soa suite. Show all posts
Sunday, May 7, 2017
Oracle SOA Suite: Two-way SSL with TLS1.2 made easy (slightly less complicated)
Transport layer security is not an easy topic. Many blogs have been written about this already. Surprisingly though, I did not find a single blog which was more or less complete and provided me with everything I needed to know to get this working on SOA Suite 12.2.1. In this blog I try to make the topic more easy to understand and provide a complete end to end example.
Monday, March 20, 2017
Oracle SOA Suite: Find that composite instance!
When executing BPM or BPEL processes, they are usually executed in the context of a specific entity. Sometimes you want to find instances involved with a specific entity. There are different ways to make this easy. You can for example use composite instance titles or sensors and set them to a unique identifier for your entity. If they have not been used, you can check the audit trail. However, manually checking the audit trail, especially if there are many instances, can be cumbersome. Also if different teams use different standards or standards have evolved over time, there might not be a single way to look for your entity identifier in composite instances. You want to automate this.
It is of course possible to write Java or WLST code and use the API to gather all relevant information. It would however require fetching large amounts of data from the SOAINFRA database to analyse. Fetching all that data into WLST or Java and combining it, would not be fast. I've created a database package / query which performs this feat directly on the 11g SOAINFRA database (and most likely with little alteration on 12c).
It is of course possible to write Java or WLST code and use the API to gather all relevant information. It would however require fetching large amounts of data from the SOAINFRA database to analyse. Fetching all that data into WLST or Java and combining it, would not be fast. I've created a database package / query which performs this feat directly on the 11g SOAINFRA database (and most likely with little alteration on 12c).
Wednesday, July 20, 2016
Oracle SOA Suite Code Quality: SonarQube Quality Gates, XML Plugin and custom XPath rules
There are several ways to do code quality checks in SOA Suite. In this blog post I will describe a minimal effort setup which uses Jenkins 2.9, SonarQube 5.6 and the SonarQube XML Plugin 1.4.1. SonarQube is a popular tool to check and visualize code quality. An XML Plugin is available for SonarQube which allows you to define custom XPath rules. At the end of this post I will shortly describe several other options which you can consider to help you improve code quality by doing automated checks.
Using SonarQube and the XML Plugin to do code quality checks on SOA Suite components has several benefits compared to other options described at the end of this post.
Using SonarQube and the XML Plugin to do code quality checks on SOA Suite components has several benefits compared to other options described at the end of this post.
- It is very flexible and relatively technology independent. It allows you to scan any XML file such as BPEL, BPMN, OSB, Mediator, Spring, composite.xml files
- It requires only configuration of SonarQube, the SonarQube XML Plugin and the CI solution (Jenkins in this example)
- It has few dependencies. It does not require an Oracle Home or custom JAR files on your SonarQube server.
- The XML Plugin has support (by SonarSource) so high probability it will still work in future versions of SonarQube.
- Writing rules is simple; XPath expressions. it does not require you to write Java code to create checks.
Sunday, February 28, 2016
Asynchronous interaction in Oracle BPEL and BPM. WS-Addressing and Correlation sets
There are different ways to achieve asynchronous interaction in Oracle SOA Suite. In this blog article, I'll explain some differences between WS-Addressing and using correlation sets (in BPEL but also mostly valid for BPM). I'll cover topics like how to put the Service Bus between calls, possible integration patterns and technical challenges.
I will also shortly describe recovery options. You can of course depend on the fault management framework. This framework however does not catch for example a BPEL Assign activity gone wrong or a failed transformation. Developer defined error handling can sometimes leave holes if not thoroughly checked. If a process which should have performed a callback, terminates because of unexpected reasons, you might be able to manually perform recovery actions to achieve the same result as when the process was successful. This usually implies manually executing a callback to a calling service. Depending on your choice of implementation for asynchronous interaction, this callback can be easy or hard.
I will also shortly describe recovery options. You can of course depend on the fault management framework. This framework however does not catch for example a BPEL Assign activity gone wrong or a failed transformation. Developer defined error handling can sometimes leave holes if not thoroughly checked. If a process which should have performed a callback, terminates because of unexpected reasons, you might be able to manually perform recovery actions to achieve the same result as when the process was successful. This usually implies manually executing a callback to a calling service. Depending on your choice of implementation for asynchronous interaction, this callback can be easy or hard.
Tuesday, May 5, 2015
Unleash the power of Java API's on your WLST scripts!
Oracle SOA Suite and many other Oracle products have extensive Java API's to expose their functionality. WLST can often be used for relatively course grained actions. WLST (the version supplied in Weblogic 12.1.3) uses Jython 2.2.1. Jython is the Python scripting language implemented on the Java Virtual Machine. Jython allows easy integration with Java. In this article I describe how you can unleash the power of these Java API's on your WLST scripts!
Friday, October 10, 2014
SOA Suite 12c: Getting started with the Spring Component
The Oracle SOA Suite Spring component has been present since SOA Suite 11.1.1.3 (11gR1 PS2). This component allows easy integration of Java code with other SOA Suite components such as (among others) BPEL, BPM and Business Rules. In SOA Suite 12c (12.1.3.0) this component is still present. In This blog post I will provide a short example on how it can be used and how the first problem I encountered with this component can be avoided.
Saturday, March 3, 2012
Loops in BPEL 1.1 and 2.0
Introduction
When programming in BPEL, an often used construction is the following;
- the input of a process contains a collection of elements
- the elements need to be processed one at a time
There are several solutions to implement this. A couple of these solutions will be discussed here.
SOA Suite 10g and SOA Suite 11g have some differences in usage of extension functions such as the one used for transformations. SOA Suite 11g (of course) provides several improvements over 10g. Also BPEL 1.1 and BPEL 2.0 standards provide different activities for handling loops.
An alternative for using loop constructions in BPEL when XML needs to be send to the database is by using XML object types. See http://javaoraclesoa.blogspot.nl/2013/03/using-plsql-object-types-to-get-nested.html for more information.
Example processes
The complete BPEL 1.1 and BPEL 2.0 example (including XSD and XSLT) can be downloaded here; http://dl.dropbox.com/u/6693935/blog/TestXSLT.zip
The example used will use the following input and output schema definitions;
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://test.ms/itemcollections"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:me="http://test.ms/itemcollections">
<element name="item" type="me:itemType"/>
<complexType name="itemType">
<sequence>
<element name="name" type="string"/>
<element name="value" type="string"/>
</sequence>
</complexType>
<element name="itemsCollection" type="me:itemsCollectionType"/>
<complexType name="itemsCollectionType">
<sequence>
<element ref="me:item" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="itemCollectionArray" type="me:itemCollectionArrayType"/>
<complexType name="itemCollectionArrayType">
<sequence>
<element ref="me:itemsCollection" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="simpleString" type="me:simpleStringType"/>
<complexType name="simpleStringType">
<sequence>
<element name="value" type="string"/>
</sequence>
</complexType>
<element name="simpleNumber" type="me:simpleNumberType"/>
<complexType name="simpleNumberType">
<sequence>
<element name="value" type="decimal"/>
</sequence>
</complexType>
</schema>
This schema has been created to illustrate how collections can be handled.
It is advisable to define your element and type definitions inside a separate XSD. This promotes re-use and maintainability. The XSD can for example be put in the MDS (as described in http://javaoraclesoa.blogspot.com/2012/02/using-mds.html). It is also very useful to define separate types for every element used. This makes defining variables containing only a part of the message easier.
The workspace contains a BPEL 1.1 and a BPEL 2.0 process which are both exposed as webservices. The BPEL 1.1 process uses a While activity together with Assign activities to process a collection. The BPEL 2.0 process uses the For Each activity and a transformation to achieve the same.
BPEL 1.1 (SOA Suite 10g + 11g)
BPEL 1.1 contains the While activity and the FlowN activity which can both be used to process collections. The While activity allows to loop over a set of activities until a certain condition is met. The FlowN activity provides the option for parallel execution and an index variable to indicate the branche which is processed. FlowN has been described in; http://javaoraclesoa.blogspot.com/2012/02/parallel-execution-and-variable-scoping.html. This part will focus on the While activity. The part describing how to get a parameter inside an XSLT transformation or use it inside an assign activity, can of course also be applied for FlowN.
The below picture shows my BPEL 1.1 sample process. It transforms the input collection on a per item basis to a local variable (which would allow processing of the individual item). Then it adds the result to the output variable.
The While condition
You can create a variable inside the scope of the while activity and increase this. The condition can be set to check whether the counter is smaller then or equal to the count of elements in the message that need processing.
Getting to your element; The element is an XSLT element
There are several ways to obtain the element you want to process. Depending on the circumstances, some options might not be available.
The easiest option is creating a variable of the type of one of the items of the collection. Then use the assign activity to assign the element.
The empty activity in the process symbolizes actions on the l_item variable. This can for example be a transformation followed by a call to a DbAdapter. The result can be transformed to a different format which can then be used to generate the output. The example is meant as a bare-bones illustration of the functionality.
Things to mind;
- it is advisable to create a scope inside the While activity and use local variables inside this scope
- in the Assign activity where you assign the item to be processed, cast the local counter variable to a number like in the following example (else the condition which selects which item to be processed, doesn't work correctly);
bpws:getVariableData('inputVariable','payload','/ns1:itemsCollection/ns1:item')[number(bpws:getVariableData('l_counter'))]
- Use the Assign append rule type and append an item to the collection for creating output.
<assign name="AssignOutputItemProcessToOutputProcess">
<bpelx:append>
<bpelx:from expression="bpws:getVariableData('l_item')"/>
<bpelx:to variable="outputVariable" part="payload"
query="/ns1:itemsCollection"/>
</bpelx:append>
</assign>
- use >= and not => in the While activity condition!
Getting to your element; The element is not an XSLT element type. BPEL 1.1 SOA Suite 10g.
BPEL 1.1 in 10g uses a different transformation function as BPEL 1.1 in 11g. The transformation activity is an Oracle extension and not part of the BPEL specification (actually it's implemented as an Assign which is part of the specification and made easier to use with a wizard). The below part is for using the BPEL 10g version.
Sometimes the element of the collection is not available as a type. This makes processing less straightforward, since a variable of the item can not readily be created in BPEL. A solution for this is using an XSLT transformation with a parameter. It is important to think about to what type you are going to transform to, since the type of the element is not available. You can create a custom element type for this., for example the name/value pair items (as specified in the introduction), can be used for that.
Using a parameter inside an XSLT transformation can for example be found on; http://rigterink.blogspot.com/2009/09/passing-xml-as-parameter-to-xslt.html
The parameter can be assigned the counter value of the While loop and be passed to the XSLT transformation. This XSLT parameter can then be used to select the correct element of the source XML to be used.
Selecting the correct element from the source XML inside an XSLT transformation, will be illustrated in the BPEL 2.0 part.
BPEL 2.0
BPEL 2.0 is only available in SOA Suite 11g and not in 10g. It has several new features which make it more easy to deal with loops. Also the bpws:getVariableData does not need to be used anymore; the syntax for accessing variables has been simplified. A dot notation can be used, for example an assign activity;
<assign name="AssignCounter">
<copy>
<from>$ForEach1Counter</from>
<to>$l_counter/ns1:value</to>
</copy>
</assign>
For Each activity
The For Each activity can be compared with the While activity, however it is more specific.
- It provides a scope for a loop (in a While activity you have to create the scope yourself)
- It provides a start and endpoint for the counter variable and the counter variable can be created in the For Each activity wizard.
- It provides an option for an additional completion expression
- It provides the option of parallel execution of the individual branches (similar to the FlowN activity in BPEL 1.1)
- it provides a variable which can be used in Assign activities, however not in XSLT transformations without some additions!
The below picture shows the BPEL 2.0 process using the For Each activity. Noticable is that I have to use less activities to achieve the same as with a While activity in BPEL 1.1.
XSLT transformations allow more input variables
The function which is used in the transformation for SOA Suite 10g BPEL 1.1 is different from the transformation function used in SOA Suite 11g BPEL 1.1 and BPEL 2.0. In SOA Suite 11g it is easier to add multiple input parameters to a single transformation in the wizard and the input parameters do not need to confer to a specific schema.
The source types for the transformation all need to be simple or complex types. it is thus easiest to use a complex type. A complex types can be selected when using the wizard to define the type of BPEL variable and by choosing one from the 'Element' or 'Message type' category. you can see examples in the schema shown at the start of this post; simpleNumberType and simpleStringType. These types are complex type wrappers for the simple types string and decimal. They allow the simple types to be used as complex types inside transformations.
Using the counter variable of a For Each activity inside an XSLT transformation, can be done as followed;
- assign the For Each counter variable to a complextype (for example the simpleNumberType)
- use the variable inside a for-each XSLT construction with a selection on the passed simpleNumberType by using the position() function.
The transformation without namespaces used, is the following (see the example ZIP for the complete XSLT);
<xsl:param name="l_counter"/>
<xsl:template match="/">
<xsl:for-each select="/ns1:itemsCollection/ns1:item[position()=$l_counter/ns1:simpleNumber/ns1:value]">
<ns1:item>
<ns1:name>
<xsl:value-of select="ns1:name"/>
</ns1:name>
<ns1:value>
<xsl:value-of select="ns1:value"/>
</ns1:value>
</ns1:item>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Note on Assigns
Changing the rule type for the assign is in SOA Suite 11g in BPEL 1.1 different then in BPEL 2.0.
BPEL 1.1
Select the rule type from the drop-down box
BPEL 2.0
Right click the From / To rule, Change rule type
When programming in BPEL, an often used construction is the following;
- the input of a process contains a collection of elements
- the elements need to be processed one at a time
There are several solutions to implement this. A couple of these solutions will be discussed here.
SOA Suite 10g and SOA Suite 11g have some differences in usage of extension functions such as the one used for transformations. SOA Suite 11g (of course) provides several improvements over 10g. Also BPEL 1.1 and BPEL 2.0 standards provide different activities for handling loops.
An alternative for using loop constructions in BPEL when XML needs to be send to the database is by using XML object types. See http://javaoraclesoa.blogspot.nl/2013/03/using-plsql-object-types-to-get-nested.html for more information.
Example processes
The complete BPEL 1.1 and BPEL 2.0 example (including XSD and XSLT) can be downloaded here; http://dl.dropbox.com/u/6693935/blog/TestXSLT.zip
The example used will use the following input and output schema definitions;
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://test.ms/itemcollections"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:me="http://test.ms/itemcollections">
<element name="item" type="me:itemType"/>
<complexType name="itemType">
<sequence>
<element name="name" type="string"/>
<element name="value" type="string"/>
</sequence>
</complexType>
<element name="itemsCollection" type="me:itemsCollectionType"/>
<complexType name="itemsCollectionType">
<sequence>
<element ref="me:item" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="itemCollectionArray" type="me:itemCollectionArrayType"/>
<complexType name="itemCollectionArrayType">
<sequence>
<element ref="me:itemsCollection" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<element name="simpleString" type="me:simpleStringType"/>
<complexType name="simpleStringType">
<sequence>
<element name="value" type="string"/>
</sequence>
</complexType>
<element name="simpleNumber" type="me:simpleNumberType"/>
<complexType name="simpleNumberType">
<sequence>
<element name="value" type="decimal"/>
</sequence>
</complexType>
</schema>
This schema has been created to illustrate how collections can be handled.
It is advisable to define your element and type definitions inside a separate XSD. This promotes re-use and maintainability. The XSD can for example be put in the MDS (as described in http://javaoraclesoa.blogspot.com/2012/02/using-mds.html). It is also very useful to define separate types for every element used. This makes defining variables containing only a part of the message easier.
The workspace contains a BPEL 1.1 and a BPEL 2.0 process which are both exposed as webservices. The BPEL 1.1 process uses a While activity together with Assign activities to process a collection. The BPEL 2.0 process uses the For Each activity and a transformation to achieve the same.
BPEL 1.1 (SOA Suite 10g + 11g)
BPEL 1.1 contains the While activity and the FlowN activity which can both be used to process collections. The While activity allows to loop over a set of activities until a certain condition is met. The FlowN activity provides the option for parallel execution and an index variable to indicate the branche which is processed. FlowN has been described in; http://javaoraclesoa.blogspot.com/2012/02/parallel-execution-and-variable-scoping.html. This part will focus on the While activity. The part describing how to get a parameter inside an XSLT transformation or use it inside an assign activity, can of course also be applied for FlowN.
The below picture shows my BPEL 1.1 sample process. It transforms the input collection on a per item basis to a local variable (which would allow processing of the individual item). Then it adds the result to the output variable.
The While condition
You can create a variable inside the scope of the while activity and increase this. The condition can be set to check whether the counter is smaller then or equal to the count of elements in the message that need processing.
Getting to your element; The element is an XSLT element
There are several ways to obtain the element you want to process. Depending on the circumstances, some options might not be available.
The easiest option is creating a variable of the type of one of the items of the collection. Then use the assign activity to assign the element.
The empty activity in the process symbolizes actions on the l_item variable. This can for example be a transformation followed by a call to a DbAdapter. The result can be transformed to a different format which can then be used to generate the output. The example is meant as a bare-bones illustration of the functionality.
Things to mind;
- it is advisable to create a scope inside the While activity and use local variables inside this scope
- in the Assign activity where you assign the item to be processed, cast the local counter variable to a number like in the following example (else the condition which selects which item to be processed, doesn't work correctly);
bpws:getVariableData('inputVariable','payload','/ns1:itemsCollection/ns1:item')[number(bpws:getVariableData('l_counter'))]
- Use the Assign append rule type and append an item to the collection for creating output.
<assign name="AssignOutputItemProcessToOutputProcess">
<bpelx:append>
<bpelx:from expression="bpws:getVariableData('l_item')"/>
<bpelx:to variable="outputVariable" part="payload"
query="/ns1:itemsCollection"/>
</bpelx:append>
</assign>
- use >= and not => in the While activity condition!
Getting to your element; The element is not an XSLT element type. BPEL 1.1 SOA Suite 10g.
BPEL 1.1 in 10g uses a different transformation function as BPEL 1.1 in 11g. The transformation activity is an Oracle extension and not part of the BPEL specification (actually it's implemented as an Assign which is part of the specification and made easier to use with a wizard). The below part is for using the BPEL 10g version.
Sometimes the element of the collection is not available as a type. This makes processing less straightforward, since a variable of the item can not readily be created in BPEL. A solution for this is using an XSLT transformation with a parameter. It is important to think about to what type you are going to transform to, since the type of the element is not available. You can create a custom element type for this., for example the name/value pair items (as specified in the introduction), can be used for that.
Using a parameter inside an XSLT transformation can for example be found on; http://rigterink.blogspot.com/2009/09/passing-xml-as-parameter-to-xslt.html
The parameter can be assigned the counter value of the While loop and be passed to the XSLT transformation. This XSLT parameter can then be used to select the correct element of the source XML to be used.
Selecting the correct element from the source XML inside an XSLT transformation, will be illustrated in the BPEL 2.0 part.
BPEL 2.0
BPEL 2.0 is only available in SOA Suite 11g and not in 10g. It has several new features which make it more easy to deal with loops. Also the bpws:getVariableData does not need to be used anymore; the syntax for accessing variables has been simplified. A dot notation can be used, for example an assign activity;
<assign name="AssignCounter">
<copy>
<from>$ForEach1Counter</from>
<to>$l_counter/ns1:value</to>
</copy>
</assign>
For Each activity
The For Each activity can be compared with the While activity, however it is more specific.
- It provides a scope for a loop (in a While activity you have to create the scope yourself)
- It provides a start and endpoint for the counter variable and the counter variable can be created in the For Each activity wizard.
- It provides an option for an additional completion expression
- It provides the option of parallel execution of the individual branches (similar to the FlowN activity in BPEL 1.1)
- it provides a variable which can be used in Assign activities, however not in XSLT transformations without some additions!
The below picture shows the BPEL 2.0 process using the For Each activity. Noticable is that I have to use less activities to achieve the same as with a While activity in BPEL 1.1.
XSLT transformations allow more input variables
The function which is used in the transformation for SOA Suite 10g BPEL 1.1 is different from the transformation function used in SOA Suite 11g BPEL 1.1 and BPEL 2.0. In SOA Suite 11g it is easier to add multiple input parameters to a single transformation in the wizard and the input parameters do not need to confer to a specific schema.
The source types for the transformation all need to be simple or complex types. it is thus easiest to use a complex type. A complex types can be selected when using the wizard to define the type of BPEL variable and by choosing one from the 'Element' or 'Message type' category. you can see examples in the schema shown at the start of this post; simpleNumberType and simpleStringType. These types are complex type wrappers for the simple types string and decimal. They allow the simple types to be used as complex types inside transformations.
Using the counter variable of a For Each activity inside an XSLT transformation, can be done as followed;
- assign the For Each counter variable to a complextype (for example the simpleNumberType)
- use the variable inside a for-each XSLT construction with a selection on the passed simpleNumberType by using the position() function.
The transformation without namespaces used, is the following (see the example ZIP for the complete XSLT);
<xsl:param name="l_counter"/>
<xsl:template match="/">
<xsl:for-each select="/ns1:itemsCollection/ns1:item[position()=$l_counter/ns1:simpleNumber/ns1:value]">
<ns1:item>
<ns1:name>
<xsl:value-of select="ns1:name"/>
</ns1:name>
<ns1:value>
<xsl:value-of select="ns1:value"/>
</ns1:value>
</ns1:item>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Note on Assigns
Changing the rule type for the assign is in SOA Suite 11g in BPEL 1.1 different then in BPEL 2.0.
BPEL 1.1
Select the rule type from the drop-down box
BPEL 2.0
Right click the From / To rule, Change rule type
Labels:
assign,
bpel,
collections,
flown,
for-each,
loop,
soa suite,
transformation,
while,
xslt
Subscribe to:
Posts (Atom)