Showing posts with label Methods. Show all posts
Showing posts with label Methods. Show all posts

Tuesday, July 22, 2014

SOA domain creation on Exalogic using Exadata

I had afew lesson learn while doing Oracle SOA Suite 11.1.1.7 platform provisioning on Exalogic using Exadata. These configurations will maximise your performance on your Oracle Engineered Systems investment.

Lesson #1:

Repository Creation Utility (RCU) has a limitation when it comes to Sockets Direct Protocol (SDP). Paul Done wrote a good article on which version of JVM is supports SDP.

The root cause with RCU is that the SDP classes are not in the startup therefore RCU only works with TCP. Therefore it is a recommended best practice to run the RCU step using the TCP during installation, example connection string below.

jdbc:oracle:thin:@(DESCRIPTION_LIST=(DESCRIPTION=(CONNECT_TIMEOUT=3)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=TCP)(HOST=db-node1-ib)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=db-node2-ib)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=SOASID))))

Once the domain has been created and running, goto each of the JDBC Data Sources and update all connection string to SDP.

jdbc:oracle:thin:@(DESCRIPTION_LIST=(DESCRIPTION=(CONNECT_TIMEOUT=3)(TRANSPORT_CONNECT_TIMEOUT=3)(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=SDP)(HOST=db-node1-ib)(PORT=1522))(ADDRESS=(PROTOCOL=SDP)(HOST=db-node2-ib)(PORT=1522)))(CONNECT_DATA=(SERVICE_NAME=SOASID))))

Lesson #2:

Modify setDomainEnv.sh to add support for SDP, this setting will be enabled for all servers in the current domain.

JAVA_OPTIONS="${JAVA_OPTIONS} -Doracle.net.SDP=true"

Lesson #3:

Managed Server is recommended to mounted exclusively by each compute node (ie. local volume). This is mention explicitly in the Exalogic Elastic Cloud Enterprise Deployment Guide for Oracle SOA Suite. This is to optimise I/O performance to disk by leveraging on Exalogic solid-state drive (SSD) technology.

However, the trade off is shared storage (NFS), shared storage enables reliability and availability through data replication and DR.

Lesson #4:

Ensures that Enable Exalogic Optimizations is selected under Domain > Configuration > General.

Refers to Oracle Support Note How To Enable Exalogic Optimizations For WebLogic Server Running On Exalogic Machine (Doc ID 1373571.1) for up-to-date details.

Database connectivity testing over SDP using Exadata

Optimising performance with Oracle Engineered Systems (Exadata). When running application such as SOA Suite, Siebel, JDE etc. connecting to database tier using Exadata.

Oracle best practice is that the Exadata is usually setup with a listener on port 1521 on the ETH / SCAN NIC(s) and on the IBoIP should be two listeners on port 1522 for TCP & SDP.

Below are steps to run on the application tier (soa-hostname in this case) to check the prerequisites before commencing product installation such as RCU.

Login to application server as oracle.
login as: oracle
oracle@soa-hostname's password:
Last login: Tue Jul 22 10:40:43 2014 from local-workstation
|-----------------------------------------------------------------|
| This system is for the use of authorized users only.            |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their   |
| activities on this system monitored and recorded by system      |
| personnel.                                                      |
|                                                                 |
| In the course of monitoring individuals improperly using this   |
| system, or in the course of system maintenance, the activities  |
| of authorized users may also be monitored.                      |
|                                                                 |
| Anyone using this system expressly consents to such monitoring  |
| and is advised that if such monitoring reveals possible         |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials.       |
|-----------------------------------------------------------------|


Set the oracle environment variables to work as a client to databases.
-bash-3.2$ . oraenv
ORACLE_SID = [oracle] ? client
The Oracle base has been set to /opt/oracle/11.2.0.3


Change directory to the location of the file tnsnames.ora.
-bash-3.2$ cd $ORACLE_HOME/network/admin

Here is where you should be. This may varies based on where your DBA installed the client.
-bash-3.2$ pwd
/opt/oracle/11.2.0.3/client/network/admin


Check the file exists, if not it will have to be created. Ask your DBA for the tnsnames.ora file.
-bash-3.2$ ls
samples  shrept.lst  tnsnames.ora


These are the current settings for connection to the SOASID database via InfiniBand IPoIB (SDP) and E0IB (TCP).
-bash-3.2$ cat tnsnames.ora
SOASID_EXALOGIC =
        (DESCRIPTION_LIST=
                (LOAD_BALANCE=off)
                (FAILOVER=on)
                (FAILOVER_MODE = (TYPE = session)(METHOD = BASIC)(RETRIES = 2)(DELAY = 3))
                (DESCRIPTION=
                        (CONNECT_TIMEOUT=3)(TRANSPORT_CONNECT_TIMEOUT=3)
                        (ADDRESS_LIST= (LOAD_BALANCE=on) (ADDRESS=(PROTOCOL=SDP)(HOST=db-node1-ib)(PORT=1522)) (ADDRESS=(PROTOCOL=SDP)(HOST=db-node2-ib)(PORT=1522)) )
                        (CONNECT_DATA=(SERVICE_NAME= SOASID))
                )
        )

SOASID_CLIENT =
        (DESCRIPTION_LIST=
                (DESCRIPTION=
                        (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=nnn.nnn.nnn.nnn)(PORT=1521)))
                        (CONNECT_DATA=(SERVICE_NAME= SOASID))
                )
        )


Check the listener can be contacted on IPoIB (SDP).  The numeric 8 at the end of the command is the number of pings.
-bash-3.2$ tnsping soasid_exalogic 8

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Sandpit on 22-JUL-2014 11:25:01

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION_LIST= (LOAD_BALANCE=off) (FAILOVER=on) (FAILOVER_MODE = (TYPE = session)(METHOD = BASIC)(RETRIES = 2)(DELAY = 3)) (DESCRIPTION= (CONNECT_TIMEOUT=3)(TRANSPORT_CONNECT_TIMEOUT=3) (ADDRESS_LIST= (LOAD_BALANCE=on) (ADDRESS=(PROTOCOL=SDP)(HOST=db-node1-ib)(PORT=1522)) (ADDRESS=(PROTOCOL=SDP)(HOST=db-node2-ib)(PORT=1522))) (CONNECT_DATA=(SERVICE_NAME= SOASID))))
OK (10 msec)
OK (10 msec)
OK (10 msec)
OK (10 msec)
OK (10 msec)
OK (20 msec)
OK (10 msec)
OK (10 msec)


Check the listener can be contacted on EoIB (TCP).
-bash-3.2$ tnsping soasid_client 8

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Sandpit on 22-JUL-2014 11:25:10

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION_LIST= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=nnn.nnn.nnn.nnn)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME= SOASID))))
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)
OK (10 msec)
OK (0 msec)
OK (0 msec)
OK (0 msec)


Connect to the database service via IPoIB & verify the account has sysdba privileges.
-bash-3.2$ sqlplus sysdba/sysdba@soasid_exalogic as sysdba

SQL*Plus: Release 11.2.0.3.0 Sandpit on Tue Jul 22 11:25:52 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Sandpit
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Sandpit
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


Connect to the database service via EoIB.
-bash-3.2$ sqlplus sysdba/sysdba@soasid_client as sysdba

SQL*Plus: Release 11.2.0.3.0 Sandpit on Tue Jul 22 11:26:07 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Sandpit
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Sandpit
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


If you've reached this far it means connectivity test to your database via SDP on Exadata is successful!

Next step, run your Oracle Repository Creation Utility (RCU).

Here are some common issues:
  • DBA have not follow Oracle Support Note on Setup Listener on Infiniband Network using both SDP and TCP Protocol (Doc ID 1580584.1).
  • Some customer choose to run SDP and TCP on port 1521.
  • iptables on the VM may block the port(s) to the database.

Monday, July 21, 2014

Convert binary data in OSB context variable into string

The function will be use to convert binary data in OSB context variable into string.

Another useful POJO to add to your OSBToolkit.java.

public class OSBToolkit
{

    public OSBToolkit()
    {
    }

    public static String convertOSBBinaryContentToString(DataSource ds) throws Exception
    {
        InputStream is=ds.getInputStream();
        BufferedReader din = new BufferedReader(new InputStreamReader(is));
        StringBuffer sb = new StringBuffer();
        try {
            String line = null;
            while((line=din.readLine()) != null){
                sb.append(line+"\n");
            }
        }
        finally{
            try{
                is.close();
            } catch(IOException ex){}
        }
        return sb.toString();
    }
}

 

Convert Siebel datetime to XML

Class to parse Siebel datetime format into XML standard format.

Another useful POJO to add to your OSBToolkit.java.

public class OSBToolkit
{

    public OSBToolkit()
    {
    }

    public static Date convertSiebelDateTimeToXML(String dateString) {
        Date stringDate = null;
       
        try
        { //If dateTime
            if(dateString.trim().length() > 10)
            {
                stringDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(dateString);

            }// If just a date
            else if(dateString.trim().length() > 0)
            {
                stringDate = new SimpleDateFormat("MM/dd/yyyy").parse(dateString);
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();   
        }
       
        return stringDate;
     }
 
 
    public static String convertXMLToSiebelDate(Date date) {
      String formattedDate ="";
      if(date != null)
      {
          SimpleDateFormat format =
            new SimpleDateFormat("MM/dd/yyyy");
          formattedDate = format.format(date);
      }
      else
      {
         
      }
        return formattedDate;
     }
}

 

Sleep/pause/throttle the transaction in OSB

From time-to-time you have requirement to sleep/pause/throttle the transaction in OSB. You can do this by using a simple POJO.

Below is a class to add to your OSBToolkit.java.

public class OSBToolkit
{

    public OSBToolkit()
    {
    }

    public static String sleep(long l)
    {
        String s;
        try
        {
            Thread.sleep(l);
            s = "Success";
        }
        catch(Exception exception)
        {
            s = "Error";
        }
        return s;
    }
}


Then from OSB, reference to the OSBToolkit and the sleep class, specify the following value as input:
xs:long(5000)
 

Friday, July 18, 2014

Oracle SOA 12c (12.1.3) silent mode installation on Linux

Step-by-step guide to installing Oracle SOA 12c (12.1.3) in silent mode for Linux, though the same can be used Windows.

Download software

  1. Download fmw_12.1.3.0.0_soaqs_Disk1_1of1.zip bundle from http://www.oracle.com/technetwork/middleware/soasuite/downloads/index.html
  2. Download jdk-8u11-linux-x64.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/index.html

Preparation

Setting up user accounts and group.
[root@sandpit ~]# adduser oracle
[root@sandpit ~]# passwd oracle
[root@sandpit ~]# groupadd oinstall 
[root@sandpit ~]# usermod -a -G oinstall oracle

 Create the oraInst.loc file.
[root@sandpit ~]$ cat /etc/oraInst.loc
inst_group=oinstall
inventory_loc=/home/oracle/oraInventory


 Logon as oracle user and unpack the software.
[oracle@sandpit ~]$ su - oracle 
[oracle@sandpit ~]$ tar -xzvf jdk-8u11-linux-x64.tar.gz
[oracle@sandpit ~]$ /home/oracle/jdk1.8.0_11/bin/java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

[oracle@sandpit ~]$ unzip fmw_12.1.3.0.0_soaqs_Disk1_1of1.zip
Archive:  fmw_12.1.3.0.0_soaqs_Disk1_1of1.zip
  inflating: fmw_12.1.3.0.0_soa_quickstart.jar 
  inflating: fmw_12.1.3.0.0_soa_quickstart2.jar


Prepare the Response file, call it say custom_installtype_soa12.1.3.rsp.
[oracle@sandpit ~]$ cat /home/oracle/custom_installtype_soa12.1.3.rsp

[ENGINE]

#DO NOT CHANGE THIS.

Response File Version=1.0.0.0.0

[GENERIC]

#Set this to true if you wish to specify a directory where latest updates are downloaded. This option would use the software updates from the specified directory

SPECIFY_DOWNLOAD_LOCATION=false

#

SKIP_SOFTWARE_UPDATES=true

#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true

SOFTWARE_UPDATES_DOWNLOAD_LOCATION=

#Write the name of the Oracle Home directory. The Oracle Home directory name may only contain alphanumeric , hyphen (-) , dot (.) and underscore (_) characters, and it must begin with an alphanumeric character.

ORACLE_HOME=/home/oracle/fmw12_1_3_0


#Write the complete path to a valid Middleware Home.

MIDDLEWARE_HOME=/home/oracle/fmw12_1_3_0

#Set this to true if typical installation must be done. If this is set to true then variable "CUSTOM TYPE" must be set to false as the variables are mutually exclusive

TYPICAL TYPE=false

#Set this to true if custom installation must be done, all other required variables need to be provided. If this is set to true then variable "TYPICAL TYPE" must be set to false as the variables are mutually exclusive.

CUSTOM TYPE=true

[SYSTEM]

[APPLICATIONS]

[RELATIONSHIPS]

Dry run test

First run for prerequisite checks.
[oracle@sandpit ~]$ /home/oracle/jdk1.8.0_11/bin/java -jar fmw_12.1.3.0.0_soa_quickstart.jar -silent -responseFile /home/oracle/custom_installtype_soa12.1.3.rsp
Launcher log file is /tmp/OraInstall2014-07-18_11-35-27AM/launcher2014-07-18_11-35-27AM.log.
Extracting files......................................................................
Starting Oracle Universal Installer

Checking if CPU speed is above 300 MHz.   Actual 1999.999 MHz    Passed
Checking swap space: must be greater than 512 MBChecking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required) 

Checking temp space: must be greater than 300 MB.   Actual 24743 MB    Passed

Some system prerequisite checks failed.
You must fulfill these requirements before continuing with the installation.

Exiting Oracle Universal Installer.
Log(s) for this session can be found in /tmp/OraInstall2014-07-18_11-35-27AM/launcher2014-07-18_11-35-27AM.log.


If the you the prerequisite failed at swap space error, run these additional commands.
[oracle@sandpit ~]$ su - root
[root@sandpit ~]# dd if=/dev/zero of=/swapfile bs=1M count=520
520+0 records in
520+0 records out
545259520 bytes (545 MB) copied, 0.880694 seconds, 619 MB/s
[root@sandpit ~]# mkswap /swapfile
Setting up swapspace version 1, size = 545255 kB
[root@sandpit ~]# swapon /swapfile


Run silent installation

[oracle@sandpit ~]$ /home/oracle/jdk1.8.0_11/bin/java -jar fmw_12.1.3.0.0_soa_quickstart.jar -silent -responseFile /home/oracle/custom_installtype_soa12.1.3.rsp
Launcher log file is /tmp/OraInstall2014-07-18_12-10-26PM/launcher2014-07-18_12-10-26PM.log.
Extracting files.........................................................
Starting Oracle Universal Installer

Checking if CPU speed is above 300 MHz.   Actual 1999.999 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 532472 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 17987 MB    Passed


Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2014-07-18_12-10-26PM
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Log: /tmp/OraInstall2014-07-18_12-10-26PM/install2014-07-18_12-10-26PM.log
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
Reading response file..
Starting check : CertifiedVersions
Expected result: One of enterprise-4,enterprise-5,enterprise-6,redhat-6,redhat-4,redhat-5,SuSE-11
Actual Result: enterprise-5
Check complete. The overall result of this check is: Passed
CertifiedVersions Check: Success.
Starting check : CheckJDKVersion
Expected result: 1.7.0_15
Actual Result: 1.8.0_11
Check complete. The overall result of this check is: Passed
CheckJDKVersion Check: Success.
Validations are enabled for this session.
Verifying data......
Copying Files...
You can find the log of this install session at:
 /tmp/OraInstall2014-07-18_12-10-26PM/install2014-07-18_12-10-26PM.log
-----------20%----------40%----------60%----------80%--------100%

The installation of Oracle Fusion Middleware 12c SOA Quick Start 12.1.3.0.0 completed successfully.
Logs successfully copied to /home/oracle/oraInventory/logs.


That's all, enjoy!

Next step, creating the domain topology.

Friday, March 22, 2013

Using Python for file processing performance

When doing file processing shell scripting is nice and simple. However when joining two files larger than 2MB, shell scripting performance is poor due to file system IO.

Consider using Python, it uses memory so you can see huge performance improvement.

Example:

#!/usr/bin/env python
# Usage: run.py [PG FILE] [OIM FILE]

import sys, time, smtplib, socket
from datetime import datetime

pg_filename = sys.argv[1]
oim_filename = sys.argv[2]

oim_emp_no_list = []
pg_emp_no_list = []

oim_records = {}

oim_file = open(oim_filename, "rt")
for line in oim_file:
  items = line.split("|")

  if items[0] == "USR_LAST_NAME" : continue
  #if items[73].find("Disabled") == -1 : continue

  oim_record = {}
  oim_record["USR_EMP_NO"] = items[8]
  oim_records[oim_record["USR_EMP_NO"]] = oim_record

  emp_no = oim_record["USR_EMP_NO"]
  if emp_no not in oim_emp_no_list: oim_emp_no_list.append(emp_no)
oim_file.close()

#print "DEBUG> OIM Active OIM count - %s" % len(oim_emp_no_list)

pg_file = open(pg_filename, "rt")
for line in pg_file:
  items = line.split("|")
  pg_record = {}
  pg_record["EmployeeCode"] = items[19]

  emp_no = pg_record["EmployeeCode"]
  if emp_no not in pg_emp_no_list: pg_emp_no_list.append(emp_no)

  try:
    oim_record = oim_records[pg_record["EmployeeCode"]]
  except KeyError:
    print "%s" % pg_record["EmployeeCode"]
    #print "%s" % line
    continue
pg_file.close()

Thursday, April 14, 2011

Setting Up Custom XPATH functions in OSB

Custom XPath functions can be setup in OSB11g by following this link : http://eelzinga.wordpress.com/2010/05/10/oracle-service-bus-11g-using-custom-xpath-functions/

Main Steps for deploying custom Xpath functions for Base64 conversion are:

1. Copy the following files - OSBUtilities.jar , OSBUtililies.properties, and OSBUtilities.xml from D:\opt\app\osb11R1\OSB_HOME\config\xpath-functions on soaosbdev1  to the corresponding path in the target environment. If the target environment has multiple machines these files needs to be copied to the $OSB_HOME\config\xpath_functions directory on each of the machine.
2. Update setDomainEnv for each of the domains to include OSBUtilities.jar on Weblogic server's classpath.
3. Restart the whole domain - admin servers and managed servers.

OSBUtilies.jar and the xml and properties file can be extended to include more custom xpath functions in future. Currently the jar contains only 1 class file - Base64Converter.class. New classes implementing new custom functions can be added to  this jar and the xml files and properties file can be extended.

Attaching the source code for Base64 converter which if you want you can put in version control..

Base64Converter.java
public class Base64Converter
{
public static String encodeBase64(String input)
{
try
{
String encoded =new sun.misc.BASE64Encoder().encode(input.getBytes( ));
return(encoded);
}
catch (Exception ex)
{
 return("error");
}
}

public static String decodeBase64(String input)
{
try
{
String decoded =new String(new sun.misc.BASE64Decoder().decodeBuffer(input));
return(decoded);
}
catch (Exception ex)
{
 return("error");
}
}

}

Monday, November 22, 2010

EDIFACT Document Identification with Oracle B2B

When receive a "document protocol identification error" on an inbound native EDI transaction set, it is possible that extraneous characters e.g. CR/LF at the end of the EDI have been added to the file. For example:
The following property setting will have Oracle B2B checks and removes them.

b2b.edi.enablePreprocess= true

The properties will need to be set in the System Mbean Browser within Enterprise manager.
Below are the steps to navigate to the System Mbean Browser, and how to invoke the B2B config Mbean.

  1. Login into Enterprise manager.
  2. Expand SOA
  3. Right click on soa-infra
  4. Select Administration
  5. Select System Mbean browser
  6. Expand Application Defined Mbeans
  7. Expand oracle.as.soainfra.config
  8. Expand the soa server domain
  9. Expand B2B config
  10. Select Operations
  11. Select addProperty
  12. Enter the desired property for the key, such as b2b.edi.enablePreprocess.
  13. Enter the value, true.
  14. Add any comments if desired.
  15. Invoke the mbean and check the b2b-config.xml that the property is reflected in the file.
  16. Restart the managed server.

Wednesday, November 10, 2010

Working with array in Oracle BPEL

This is an extension usage of array based from my previous post.

In the following example the variable Variable_whileLoopIteration is the iteration counter in the WHILE activity.

Reading from a specific element in an array:
<assign name="Extract_ProductName">
<copy>
<from expression="bpws:getVariableData('Variable_PurchaseOrder',concat('/ns1:purchaseOrder/ns1:items/ns1:item[',bpws:getVariableData('Variable_whileLoopIteration'),']/ns1:productName'))"/>
<to variable="Variable_productName"/>
</copy>
</assign>
Writing to a specific element in an array:
<assign name="Assign_NewProductNameToPO">
<copy>
<from expression="'NewProductName'"/>
<to variable="Variable_PurchaseOrder" query="/ns1:purchaseOrder/ns1:items/ns1:item[position() = bpws:getVariableData('Variable_whileLoopIteration')]/ns1:productName"/>
</copy>
</assign>

My advise is don't rely on JDeveloper Design view alone. Most of the time you have to manually edit the source to get it to do exactly what you want.

Tuesday, November 09, 2010

Convert Gregorian Date to JD Edwards Date in XSLT

Q: How to convert Gregorian Date to JDE Date in XSLT?

The format is C-YY-DDD, which is used by JD Edwards software: the century after 1900, the year in that century and the Julian date within that year.  Here are a few examples:

Checkout JDE Julian Date Converter tool by David Macek.

Important: Make sure you declare the XSLT version 2.0!
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0">
...
<ns1:JDEDateNumber>
<xsl:variable name="InStringDate" select="'2010-11-09'"/>
<xsl:variable name="Year" select="substring($InStringDate,1,4)"/>
<xsl:variable name="ShortYear" select="substring($InStringDate,3,2)"/>
<xsl:variable name="StartOfYear" select='concat($Year,"-01-01")'/>
<xsl:value-of select="concat('1', $ShortYear, format-number(days-from-duration((xsd:date($InStringDate) - xsd:date($StartOfYear))) + 1, '000'))"/>
</ns1:JDEDateNumber>
...
</xsl:stylesheet>

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!

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:

Friday, July 30, 2010

autoRefresh() usage in webMethods Composite Application Framework (CAF)

When working with webMethods Designer CAF Development, consider enabling autoRefresh() properties during design-time.

Why? Because reference data or static data that used to populate drop-down options on the UI, enabling autoRefresh() return the results from cache. The underline attributes worked the same as caching in flow services - when the input data changed, only then that the service will invoke the web service connector for the updated result set.


The effect is streamlining the user experience and making navigation between screens alot more responsive.

This property is available in webMethods Designer, My webMethods perspective, under the Bindings tab.

Tuesday, July 13, 2010

Briefing on Issue Management

I have not found the time to attempt the ITIL V3 Foundation certification. But from time-to-time I advised customers on ITIL principles:

Issues can be identified directly or they can eventuate when risks are realised. Issues that cannot be resolved within tolerances (budget, time, quality, scope, etc) may lead to Change Requests.

StepResponsible Role (Group / Title) Required OutputKey Steps
1. Identify All Issue created on issue log, Status set to "Raised"
  1. It is the responsibility of everyone to identify issues that are impacting a project. Identified issues are evaluated with the relevant Project Manager to determine if a true issue exists.
  2. Project Managers then log unresolved issues to the issue log.
  3. The status of the Issue should be set to "Raised"
2. Analyse Project Managers
Risk & Issues Manager
Issue log updated
Priority assigned
Status set to "Assessed"
  1. The full analysis of each issue should occur within one week of the issue being recorded on the issue log.
  2. Ensure a full description of the issue is captured in the issue log.
  3. An initial assessment of the impact of the issue will be made and a priority will be assigned. Issues impacting business as a whole will be escalated to the Risk and Issues Manager. The status of the Issue should be set to "Assessed"
3. Action Project Managers
Risk & Issues Manager
Issue log updated
Priority re-evaluated
Issue Owner assigned
Action Plan defined
Status set to "Assigned"
  1. Each issue is assigned to an appropriate project resource (Issue Owner).
  2. Issue impact and priority is re-evaluated with the Project Manager and stakeholders directly impacted by the issue.
  3. Actions that are considered appropriate to resolve the issue, are defined and an owner for each action is appointed with an appropriate due date for the action.
  4. The action plan must be agreed with the relevant Project Manager and stakeholders.
  5. The status of the Issue should be set to "Assigned"
4. Resolution Issue Owner (Project Team Member) Execution of action plan
Status set to "Resolved"
Issue action plan is executed and progress is reported to the relevant Project Manager (and Risk and Issues Manager) via updates to the issue log and weekly meetings.
5. Monitor & Control Project Managers
Risk & Issues Manager
Issue detail included in status report The monitoring and reporting of issues is an ongoing multi faceted process, this process is defined further in the section below.
6. Close Project Manager (project-level issues)
Risk & Issues Manager (program-level issues)
Status set to "Closed"
  1. Once an issue has been fully resolved it should be closed within the issue log. The originator of the issue must confirm that the issue is resolved before it can be closed. When issues are closed a risk may need to be raised if the issue has the potential to reoccur.
  2. The status of the Issue should be set to "Closed"

Wednesday, July 07, 2010

Virtual scaling pattern

While reading into software architecture to support high dynamic scalability and high availability I stumbled upon on a well-written article, The Impact of Virtualization on Software Architecture by Nishant Thorat and Arvind Raghavendran.

Scalability and high availability has been one of the painful realisation for one of my customer. Three months after go-live they starts to find performance issues and the solution struggling to process large number of business transactions. Amongst the 41-page recommendation report, as a tactical (short-term) resolution I recommended the customer to go with virtual scaling pattern to ease their immediate pain.

Figure source: The Different Paths to Virtualization, Issue 24, The Architecture Journal

Friday, June 25, 2010

Customer engagement template

Regardless whether the customer engagement is one week or one year, I always organise the my files in the following hierarchy. Firstly, it helps you focus on the purpose and customer expectation. Secondly, some customers are difficult being organised allows you to backtrack all your work for justification.
01 Statement of work
02 Research and Analyse
03 Architecture and Design
05 Project Management
06 Project Deliverables
07 Administration
09 Tools
10 References
11 Working
I find one of the most useful tool to keep my notes is Tiddylywiki (www.tiddlywiki.com). It is extremely easy to use and no setup required.