Thursday, October 28, 2010

Configuring Oracle SOA Suite 11g with JDE on AS400 using JDBC

Awhile back I have attempted at using Oracle Application Adapter for JDE without much success, namely because there is no known customer currently. So I'm defaulting to JDBC as a means to connect to our JDE ERP8.

This is a guide for how to configure Oracle SOA Suite 11g to a JD Edwards ERP8 running on AS400 (iSeries). You will need to do these steps to setup your runtime environment.

  1. Download/extract IBM Toolkit for Java/JTOpen.
  2. Create a new directory, C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\as400
  3. Copy the jt400.jar to C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\as400\jt400.jar
  4. Edit C:\Oracle\Middleware\wlserver_10.3\common\bin\commEnv.cmd
  5. Append the new jar file in step (3) to the WEBLOGIC_CLASSPATH
  6. Restart both AdminServer and soa_server1.
  7. Goto Oracle Weblogic Administration Console (http://localhost:7001/console/)
  8. Navigate to soa_domain > Services > JDBC > Data Sources
  9. Add new JDBC Data Source, Name = AS400Connection, JNDI Name = jdbc/AS400Connection, Database Type = DB2 for i5/OS
  10. Database Driver as JTOpen's DB2 for i5/OS Driver (Type 4) IBM Toolkit for Java; Version 8.X, 9.X
  11. If you choose non-XA, remember to uncheck Supports Global Transactions.
  12. When prompted for the database port number, put in a temporary port as 60000.
  13. On the Test Database Connection screen, make sure you overwrite the database URL to match your environment, ie. jdbc:as400://JDESERVER;naming=DATASOURCE;errors=full.
  14. Deploy to target server soa_server1.
  15. If test connection failed with the error message "Cannot load driver: com.ibm.as400.access.AS400JDBCDriver", then repeat step (2) - (6)
  16. Next, create a new Outbound Connection Pool Configuration, Interface Name = javax.resource.cci.ConnectionFactory, JNDI Name = eis/DB/AS400Connection, dataSourceName = jdbc/AS400Connection.
  17. Save and run Update action on DBAdapter
  18. Done!

Configuring JDeveloper 11g with AS400

The following steps is a guide on how to connect to an AS400 database using JDBC and JDeveloper 11g for design-time. Where my local JDeveloper installation is at C:\Oracle\sqldeveloper and my JDE server name is JDEEnt1.
  1. Download/extract IBM Toolkit for Java/JTOpen.
  2. Copy the jt400.jar to C:\Oracle\sqldeveloper\jdbc\lib\jt400.jar
  3. Navigate to Tools > Preferences > Database > JDBC Driver Options
  4. Add a new JDBC Driver, calling the driver class as "com.ibm.as400.access.AS400JDBCDriver"
  5. For the Library definition, click Browse
  6. Name the Library as "AS400 JDBC"
  7. Add entry to the class path, referencing the jar file in step (2)
  8. Your new AS400 JDBC Driver should look like this
  9. Back to your SOA composite, simple use the Database Adapter
  10. The Database Adapter wizard will prompt you to create a new connection.
  11. Select Connection Type as "Generic JDBC" and Driver Class as "com.ibm.as400.access.AS400JDBCDriver"
  12. Now test the connection

  13. Done!

Wednesday, October 27, 2010

Register a new Australian company

This is a guide on how to register a new proprietary Australian company.

  1. Read the Corporations Act 2001 to understand your legal obligations.
  2. Start searching for available company names at the ASIC website. You are not allow to register the company name if its already being registered by a sole trader in a different state/territory. "MyCompany" and "My Company" is effectively the same.
  3. Complete the Form 201 Application for registration as an Australian company, see my sample form.
  4. Goto the ASIC office in person to get the company name registered immediate or post your application will takes 1-2 weeks.
  5. Pay $412.00 for the application fee. An accountant will charge you $800.00-$1200.00 for the service.

For more information read Starting a Company or Business.

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.