Monday, February 13, 2012

Time Zone conversions in Oracle SOA 10g BPEL process

Date/Time conversion from one timezone to another - I feel this is not a rare requirement for any global customer.

To simplify the post here i am giving

Problem Statement: How to change the date/time in the BPEL request to a date/time with different timezone?

Solution: Use Oracle SOA 10g BPEL's 'Java Embedded' activity and write java code for date conversion.

Though i am referring particularly Oracle SOA 10g here the idea can be used in any "JAVA" base SOA tool ( like JCAPA, Open ESB , etc...) if it allows a Java coding in their BPEL based interface development(OR in any form of interface development).

Here are the steps to follow

1.) Read input date/time value from the BPEL input message and convert it to java.lang.String Object

2.) Create two java.text.DateFormat objects one with the source timezone format (let us say the variable name is 'oSourceDtFormat') and second with target timezone format ( let us say the variable name is 'oTargetDtFormat' )

3.) Parse the date/time String to java.util.Date Object using oSourceDtFormat.parse("input date/time String") method

4.) Format the Date object in Step 3 in to the target date/time format, using oTargetDtFormat.format() method, it returns the required date/time in String format.


Here is the pseudo code. that can be used in Oracle SOA 10g 'Embedded Java' activity


String sInputTime=(String)getVariableData("sourceDateTime");
//Assuming the variable 'sourceDateTime' is holding input date/time value

java.util.TimeZone oTargetTZ = java.util.TimeZone.getTimeZone("CST");
//Assuming the target Time Zone is 'CST'
java.text.DateFormat oSourceDtFormat = new java.text.SimpleDateFormat("yyyyMMdd hh:mm a z");
//20100923 01:00 PM CDT assume the input date/time has timeZone component

java.text.DateFormat oTargetDtFormat = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
//target date/time format "yyyy/MM/dd HH:mm");

oTargetDtFormat.setTimeZone(oTargetTZ);
//Set the time zone to target time
java.util.Date oDate = null;

try{
oDate = (java.util.Date)oSourceDtFormat.parse(sInputTime);
try{
oDate = (java.util.Date)oSourceDtFormat.parse(sInputTime);
java.lang.String sSourceTime = oSourceDtFormat.format(oDate);
addAuditTrailEntry("Input bid-date-time is ::", sSourceTime);

java.lang.String sTargetTime = oTargetDtFormat.format(oDate);
setVariableData("targetDateTime", sTargetTime);
//Assuming the 'targetDateTime is a variable in BPEL process
addAuditTrailEntry("Date/Time in target timezone ::", sTargetTime);

}catch(Exception e){
addAuditTrailEntry(e);
}

Hope this helps..................




Monday, January 19, 2009

Friday, January 2, 2009

Sun Certified Integrator for Identity Manager 7.1

I thought of testing my Luck and doing some adventurous thing on 31st Dec 2008-as a final thing I could in the year :-) and I decided to write Sun Certified Integrator for Identity Manager 7.1 exam with out having even a single project experience on IDM. Thinking I am crazy? :-) Not really, there is one more reason for that- I just wanted to utilize my Sun certification voucher which is going to expire on 31st Dec 2008.



My overall opinion on the exam is “It can be cracked”. Here is my experience; the exam contains total 56 multiple choice questions out of which we have to answer 43% of questions correctly to pass the exam, are you going to write this exam in near future? here are some points that can help you in the exam preparation.

  1. There are around 6 to 7 questions on EXPRESS language, the questions would be like asking for the syntax errors in a given code snippet, asking for the output of a given code snippet etc.. I feel spending considerable preparation time on EXPRESS language would be a good idea.


  2. There are around 5 to 6 questions on SPML, SPML I mean both SPML1.0 and SPML2.0. The questions would be on the differences between SPML1.0 and SPML2.0, what are the SPML capabilities supported by Sun Identity Manager and also on SPML API.


  3. There are some questions on SPE; I feel the first point of contact for SPE preparation would be idmspe-refkit.zip that comes with the IDM installation. Of course preparation from other sources will always help. The questions I have got are like asking for the output of a given code snippet and how to invoke a method from the EXPRESS code etc..


  4. Most of the questions i have got are from real time scenarios, meaning given a client’s problem scenario which action would be an appropriate to solve the problem. I feel having a full project life cycle experience (i.e., right from the requirements gathering to deployment in production) would be the only way to correctly answer 100% of these questions. This section also includes the experience on development estimations (Question is something like ‘which of the following tasks can be delivered quickly?’).


  5. There are some questions on IDM concepts like ‘Delegated administration’, ‘Password Sync’, ‘Identity Sync’, ’Rules’, ‘Forms’, ‘Workflows’, ‘variables’ (in Forms, Rules and WFs), ‘Controlled Organizations’ and ‘Capabilities’, etc..


  6. Also there are some questions on ‘Real time Performance issues’. The question I have got is like ‘The client noticed that a workflow is causing a delay in application response time, which of the following could improve the performance?’, etc..


These are the points I could make out of my experience, if anyone has some additional points to add please feel free to put them in your comments.