Tuesday, March 24, 2009

retrieving header information using header functions

There is always a misconception that file name can be retrieved only if we use File adapter and not FTP adapter. The problem is that people use the same namespace for retrieving header information in both File adapter and FTP adapter.

I will bring out the difference in namespaces that needs to be done when we use the header functions for File adapter and for FTP adapter.

I am highlighting the differences in red.

For FileAdapter


<xsl:variable select="ehdr:getRequestHeader('/fhdr:InboundFileHeaderType/fhdr:fileName','fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;’)” />


FTP adater


<xsl:value-of select="ehdr:getRequestHeader("/fhdr:InboundFTPHeaderType/fhdr:fileName","fhdr=http://xmlns.oracle.com/pcbpel/adapter/ftp/;")" />

Hope this helps.

Sunday, March 15, 2009

issue with Xp20:Current-Datetime function during Daylight saving


There is a issue in using Xp20:Current-Datetime function. The function will return you the current time, but during day light saving period it will return you the time 1hour ahead of current time.

So need to be careful while using this function. We were using the time to store as the last run time and it always gave 1 hour ahead of current time. For example format of current-DateTime function is like 2009-03-12T21:46:22-08:00. ‘-08:00’ char which used to cause all the issues.

This is the work around mentioned in METALINK to get the correct datetime value.

Step 1: Create two variables in the BPEL process

<variable name="curDatetime" type="xsd:string"/>
<variable name="curDT" type="xsd:dateTime"/>

Step 2; Create an Assign activity and two copy rules as follows,
<assign name="AssignCurrentDateTime">
<from expression="xp20:current-dateTime()"/>
<to variable="curDatetime"/>
<from expression="concat(ora:formatDate(bpws:getVariableData('curDatetime'), 'yyyy-MM-dd'), 'T', ora:formatDate(bpws:getVariableData('curDatetime'),'HH:mm:ss'),substring(string(ora:formatDate(bpws:getVariableData('curDatetime'), 'Z')),1,3),':',substring(string(ora:formatDate(bpws:getVariableData('curDatetime'), 'Z')),4))"/>
<to variable="curDT"/>

The CurDT variable should have the correct datatime value.