Tuesday, October 19, 2010

Looping over each nodes in Oracle BPEL

This is an example how to use WHILE loop in Oracle BPEL Process Manager 11g.



This example will be based on the JDEPurchaseOrders.xsd schema and the JDEPurchaseOrders.xml sample data.

Step 1, create another XSD to map your temporary data at for each node. Let's call it JDEPurchaseOrder.xsd.

Step 2, create variables based on the message type that contains this collection, and 2 counters, Variable_LoopRunningIndex for the running index, and Variable_LoopCounter for the length of the collection.As shown below:

    <variable name="Variable_LoopRunningIndex" type="xsd:integer"/>
    <variable name="Variable_LoopCounter" type="xsd:integer"/>
    <variable name="Variable_tempJDEPurchaseOrder" element="ns3:HEADER"/>

Step 3, initialise variables for looping.
    <assign name="Initialise_WhileLoop">
      <copy>
        <from expression="number(1)"/>
        <to variable="Variable_LoopRunningIndex"/>
      </copy>
      <copy>
        <from expression="ora:countNodes('Receive_JDEFlatfile_Read_InputVariable','body','/ns3:JDEPurchaseOrder/ns3:HEADER/ns3:ID') + 1"/>
        <to variable="Variable_LoopCounter"/>
      </copy>
    </assign> 
Step 4, implement BPEL while activity to loop over each node
    <while name="For_Each_Header_Record"
           condition="bpws:getVariableData('Variable_LoopRunningIndex') &lt; bpws:getVariableData('Variable_LoopCounter')">
      <bpelx:annotation>
        <bpelx:general>
          <bpelx:property name="userLabel">For_Each_Header_Record</bpelx:property>
        </bpelx:general>
      </bpelx:annotation>
      <sequence name="Split_Purchase_Order">
        <scope name="Scope_1">
        <!-- Declare scope variables -->
          <variables>
            <variable name="Variable_selector" type="xsd:string"/>
            <variable name="Variable_tempJDEPurchaseOrder" element="ns3:HEADER"/>
          </variables>
          <sequence name="Sequence_1">
          <!-- Map current node into temp struct -->
            <assign name="Create_tempJDEPurchaseOrder">
              <copy>
                <from expression="concat(&quot;/ns3:JDEPurchaseOrder/ns3:HEADER[&quot;, string(bpws:getVariableData('Variable_LoopRunningIndex')),&quot;]&quot;)"/>
                <to variable="Variable_selector"/>
              </copy>
              <copy>
                <from expression="bpws:getVariableData('Receive_JDEFlatfile_Read_InputVariable','body', bpws:getVariableData('Variable_selector'))"/>
                <to variable="Variable_tempJDEPurchaseOrder"/>
              </copy>
            </assign>
            <!-- Transform temp struct required output -->
            <assign name="XForm_tempJDEPurchaseOrder_to_EDIFACT">
              <bpelx:annotation>
                <bpelx:pattern>transformation</bpelx:pattern>
              </bpelx:annotation>
              <copy>
                <from expression="ora:processXSLT('xsl/XForm_tmpJDEPurchaseOrder2EDIFACT.xsl',bpws:getVariableData('Variable_tempJDEPurchaseOrder'))"/>
                <to variable="SendPurchaseOrder_send_InputVariable"
                    part="body"/>
              </copy>
            </assign>
            <!-- Send output to B2B to dispatch -->
            <invoke name="SendPurchaseOrder"
                    inputVariable="SendPurchaseOrder_send_InputVariable"
                    partnerLink="DispatchPurchaseOrder"
                    portType="ns2:B2B_send_ptt" operation="send">
              <bpelx:inputProperty name="b2b.documentProtocolVersion"
                                   variable="Variable_documentProtocolVersion"/>
              <bpelx:inputProperty name="b2b.documentTypeName"
                                   variable="Variable_documentTypeName"/>
              <bpelx:inputProperty name="b2b.toTradingPartnerId"
                                   variable="Variable_toTradingPartnerId"/>
            </invoke>
          </sequence>
        </scope>
        <!-- Increment the index and repeat next node -->
        <assign name="Increment_LoopRunningIndex">
          <copy>
            <from expression="bpws:getVariableData('Variable_LoopRunningIndex') + 1"/>
            <to variable="Variable_LoopRunningIndex"/>
          </copy>
        </assign>
      </sequence>
    </while> 

Thursday, October 14, 2010

Working with DB2 on AS/400

I have a customer kick starting their SOA mobilisation project with the Procurement-to-Payment business process, using Oracle SOA Suite 11g integrating with JD Edwards XE 7.334. Below are some learning.

DBMS on an iSeries is commonly referred to (but I think mistakenly called) DB2, it is not the same as DB2 on AIX or Z/OS.

Before you can access the datasource from Oracle SOA Suite 11g, you will need to download and install the JDBC DB2 for AS/400 from JTOpen.

The current Oracle SQL Developer 2.1.1 do not have support for DB2 for AS/400. Best tool for the simple data analysis is DBVisualizer, the free version but lean on features. However, if you want to perform data migration, export, complex SQL, etc you should checkout SQL-Workbench.

Friday, September 17, 2010

Debugging Oracle BPEL process using Sensors in 11g

Sensor is a great feature if you want customise audit trail or debug BPEL processes. The following use case is logging a custom audit message after a transformation BPEL activity has finished, the steps are as follows:

1. Open the composite application

2. Go into your BPEL process

3. Add a new variable called "AuditMessage"



4. Populate value for AuditMessage, in this case I want to set "ReadMessage process step completed successfully." message to the AuditMessage at ReadMessage process step.



5. Change to Monitor View

6. Create sensor at the ReadMessage process step

7. Label the sensor as "ActivitySensor_ReadMessage"

8. Set evaluation time at Completion

9. Create activity variable sensor

10. Create sensor action

11. Sensor is illustrated with an antena icon

12. Save and deploy your composite application

13. Run your composite application
14. Logon to Oracle Enterprise Manager and navigate to SOA Infra

15. Click on the Instance ID

16. Click on the BPEL component

17. Navigate to Sensor Values tab

Further reading:

Thursday, September 02, 2010

Oracle Fusion Middleware #2

A brief version history:
8i and 8i - The i stands for "Internet" to indicate that 8/9i is "Internet ready".
10g and 11g - The g stands for "grid" to indicate that 10/11g is "grid-computing ready".
11gR2 is the second and terminal release. The common theme for this release is "Consolidate. Compress. Control."

Oracle Corporation has been agressively acquiring best of breed software power house, most recently BEA and Sun Microsystems. What that means for consultants like myself is a rich technology stack for delivering innovative solutions. Software consolidation is still progressing. Here are some tools I was was using this week.

Oracle Weblogic Server:

Oracle Enterprise Manager:

Oracle JRockit Mission Control:

Java VisualVM:

Wednesday, September 01, 2010

Oracle Fusion Middleware #1

My decision to move to Oracle® Fusion Middleware because it integrates well with most customer's existing back-office systems.

Over the next few months I am going to take an in depth view of how Oracle SOA Suite is being applied to SOA and Semantic Integration.

Tuesday, August 17, 2010

Modularisation of the integration services must support reuse across business domains

Integration solutions are means to provide capability exposed as integration services. These services are govern by metadata in the service registry to be use during design-time. Current usage of service metadata is only for binding service contract. An emerging trend is extrapolating service metadata for semantic service discovery in run-time.

Integration services can be extended to meet domain specific business requirements. However, project team needs to factor in service version changes.

Reusable services is the core driver for most of "IT cost reduction" and "lowering cost of ownership" initiatives.

Service-Oriented Architecture (SOA) lays the foundation for reuse of functions through interfaces (refactoring your legacy functions as web services is not SOA enablement).

Service registry must be the starting point in your design options study. Reuse integration services where necessary. Follow policy to obey the service contract and register dependencies against the service. Good Architect must comes up with at least two design options for every solution.

Common processing steps must be separated from the specific requirements of individual products.

User oriented functions must be separated from core business logic processing.

Decision support functions must be separated from transactional processing.

Thursday, August 05, 2010

Integration Architecture must be current and relevant

The Integration Architecture is both a process and the result of the process. The process is iterative and the results are incremental. It will be regularly enhanced, updated and communicated.

Strong Integration Architecture continuity requires constant updates to adapt with Technology, IT trends, economic condition and objectives of the organisation.

Lessons from the past:
  • Development and projects must update the Integration Architecture.
  • There must be a process for the review and assessment of Integration Architecture.
  • Audit by an external consultant on a regular basis.
  • Utilise industry standards.
  • Peer review must be a minimum assurance mechanism for any change to the Integration Architecture.
  • Business and information system strategy must inform Integration Architecture.
  • Industry trends must be considered.
  • The Integration Architecture must capture both the future state and the current state models.
  • Short-term tactical solutions versus long-term strategic solutions must be constantly re-examined.
  • “Just enough architecture, just in time”: The Pareto principle must be embedded within the architecture development cycle, creating an understanding for the application of the 80/20 rule and culture.