Wednesday, December 21, 2011

Difference in Retrieving value from OSB body variable and other OSB variable

As I am new to the OSB , I got stuck with this problem while developing an interface in my current project. My objective was to capture a unique ID from incoming SOAP request message. My SOAP request message is as follows

<soapenv:Envelope xmlns:soapenv="" xmlns:cus="" xmlns:ahs=> <soapenv:Body xmlns:soapenv=""> <cus:SampleUpDispStInput xmlns:cus="" > <ahs:ListOfSampleUpDispSt xmlns:ahs=""> <ahs:Action> <!--Optional:--> <ahs:ProjId>1-2N94XX</ahs:ProjId> <ahs:CompletedDate>12/07/2011</ahs:CompletedDate> <ahs:Status>Assigned</ahs:Status> </ahs:Action> </ahs:ListOfSampleUpDispSt > </cus:SampleUpDispStInput> </soapenv:Body> </soapenv:Envelope>

My Objective is to capture the ProjId value from the SOAP message. So I have created a variable to capture the <soapenv:Body> value and using an assign activity I have captured the entire body value in that variable. My Assignment statement xpath is “$body” and I have used a variable named “varResponseBody” .


I was surprised at next step when while trying to capture the <ahs:ProjId> value from $varResponseBody using an Assign activity. The Xpath was given as “$varResponseBody/cus:SampleUpDispStInput/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()”. Because my understanding was as I have copied the “body” variable in “varResponseBody” it would have everything as the body variable has, which was correct because as per our testing in OSB console to print the “varResponseBody” it gives us below output.


But I was unaware of the fact that the difference lies in the context of $body and $varResponseBody . Please find below snapshot.




So If we are trying to capture ProjId value based on $body then the xpath will be “$body/cus:SampleUpDispStInput/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()” and If we are trying to capture ProjId value based on $varResponseBody then the xpath will be  “$varResponseBody/ahs:ListOfSampleUpDispSt/ahs:Action/ahs:ProjId/text()”

Sunday, October 30, 2011

Work Around: Popup forces user to enter required values first


In my previous project I came across a typical problem While trying to enter value using pop up. The problem is If other required fields on same page are not entered and button/link for generating popup pressed , then an error message appears like below. It forces us to enter required values first.


As a work around I have used the option [immediate=true] for the button/link responsible for the pop up to be generated. Please follow below snap shot. Earlier command link selectText has no option set as [immediate=true] and we get above error.


After setting the option [immediate=true] for the command link selectText, above error resolved as we redeploy it.


Below screen shows that all required fields are empty but it is not prompting us to enter required fields while trying to open popup as user can enter data successfully in pop up and no restriction comes from required fields.


Saturday, October 29, 2011

Field Validation in ADF as user Tab out

In this blog I am trying to show validation as user tab out any field in ADF. User enter data in a form field and as he tab out the field validation happens and If validation criteria does not meet error message appears.


An ADF application has model and ViewController project. We can create the form in ViewController project. Please follow my previous blogs for the basics of Form generation in ViewController project. So rather than spending much time on the basics like Form generation , I would like to show special things I have done here to accomplish above goal.

Step1: Create a java class and implement javax.faces.validator.Validator, Implementation of Validator will ask for the validate(FacesContext facesContext, UIComponent uiComponent,Object object) method to be Implemented. Here I have created a java class named EmailValidator. This java file can be downloaded from link. Similarly we can create another java file for date validation. Please download the same from link.

Step2: Declare these java files as validator in faces-config.xml file. Please refer below snapshot


Step3: Modify your form so that it will not obey default validator and follow the custom validator you have created in step2. Please follow below entry in your jsff file.


Please download the jsff file from below link

Please deploy and it will work as expected.


Friday, September 2, 2011

BPEL Composites start recovery automatically , Creating Instances after 5 minute: Dealing with Automatic Recovery Settings


In our production server we faced this typical issue and initially thought of having problem in our JCA adapter. The issue was few BPEL process faulted instance starts automatically and again faulted for same reason and we had no control over its start time. As shown in below snap shot our BPEL composite first faulted on 29th August 7:33:59 PM and again starts on 30th August 00:00:36 AM. As a result huge number of faulted instance piled up and crashes the server.


As a fix we shift our thoughts from JCA adapter Retrying bug to SOA Server Recovery settings. Initially we are searching for bug in JCA adapter, as we thought that JCA adapter retry settings make that happens. But actually SOA server automatic Recovery Settings tried that faulted instances to recover for a certain period of time. Please refer below screen shot for default values of SOA Server Automatic Recovery.

Detail description for those attributes are explained by oracle, please refer


Step 1: As a fix we went to our Production server and expand SOA and then right click to soa-infra and select BPEL properties. Please refer below screen shot.


Step 2: Select “More BPEL Configuration Properties” (Refer Below Screen shot)


Step 3: Select “RecoveryConfig” (Refer Below Screen shot)


Step 4: Change Stop Window Time to 00:00 (same as Start Window time , so Recovery Period becomes negligible).


Monday, August 8, 2011

Achieving “While” functionality in XSL using recursive custom template call

Few days before I came across one XSL transformation business requirement where an xml element of Input data is having  two sub elements named “NumberBlockVON” and “NumberBlockBIS” . Name of these two is mentioned by our business user.  “NumberBlockVON” will have a positive Integer value and same happens for “NumberBlockBIS” . Now the requirement was whatever value specified as “NumberBlockBIS” that will be treated in output xml as “the power of” the value specified for “NumberBlockVON” . It means in out put xml “NumberBlockVON” will pass as it is but the value for “NumberBlockBIS” will be replaced by the <NumberBlockVON> to the power of <NumberBlockBIS>.
&lt;PickPackShipCustomElement&gt; &lt;NumberBlockVON&gt;5&lt;/NumberBlockVON&gt; &lt;NumberBlockBIS&gt;6&lt;/NumberBlockBIS&gt; &lt;/PickPackShipCustomElement&gt;
Now if it is a java requirement we can finished it off easily by writing a looping construct with the limit from 0 to <NumberBlockBIS>, and multiply the <NumberBlockVON> that many times. But here the problem is XSL constructs can loop through xml nodes , but it can’t loop through from 0 to any other specific value with in a single xml node. So we cant depend on XSL given constructs.
We use a custom XSL template to achieve this and call the template recursively with tuned parameters.<NumberBlockVON> value and <NumberBlockBIS>value is passed as a parameter to the template.How we achieve this is explained below with code snippet.

&lt; !--parameter limit_var is used to hold value of NumberBlockBIS which is used as a power value
&lt; !--parameter var is used to hold value of NumberBlockVON which is used as a base value
&lt;xsl:param name="var"/&gt;
&lt; !--parameter Outvar is used to hold output value 
&lt;xsl:param name="Outvar" select="1"/&gt; &lt;xsl:param name="count_index" select="0"/&gt; &lt;xsl:variable name="out_var" select="$Outvar"/&gt;
&lt; !--while logic Implementation
&lt; !--Is limit achieved --&gt;
    &lt;xsl:when test="$count_index &lt; $limit_var"&gt;
&lt; !--recursive template call if limit does not achieved--
&lt;xsl:call-template name="whileImplTemplate"&gt; &lt;xsl:with-param name="limit_var" select="$limit_var"/&gt; &lt;xsl:with-param name="var" select="$var"/&gt; &lt;xsl:with-param name="count_index" select="number($count_index)+1"/&gt; &lt;xsl:with-param name="Outvar" select="number($var)*number($out_var)"/&gt; &lt;/xsl:call-template&gt;
&lt; !-- End template --&gt;
&lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="$out_var"/&gt;
&lt; !--If limit achieved then print value --&gt;
As a result the output comes like below
&lt;PickPackElement&gt; &lt;NumberBlockVON&gt;5&lt;/NumberBlockVON&gt; &lt;NumberBlockBIS&gt;15625&lt;/NumberBlockBIS&gt; &lt;/PickPackElement&gt;

Sunday, June 19, 2011

Oracle SOA composite Deployment and Migration using WLST script


Step 1: Prepare execution location and codebase in the server where SOA is installed

We need to create a directory in the server location where SOA installed .From that directory we need to execute our deployment scripts.For example, I assume that directory as /app/deployment. Similarly for codebase we need to create another directory. I assume that directory as /app/codebase. We need to put our composite project source here (Not application file[.jws])

Step 2: Generate Configuration Plan:

Configuration plan is created based on composite.xml. This plan is used to modify server references in BPEL process.After developing SOA composites using JDeveloper , we need to generate configuration plan file by right clicking on the composite.xml file.



We can SFTP that Composite project folder including the configuration file to /app/codebase.

Step 3: Create Deployment Property file

We need to create a property file under /app/deployment directory. Sample Property file will look like below. Named the property file as deploy<BPEL Name>.properties.

  1. filenamewithpath=<SAR file location>
  2. oraclehome=<Oracle Home Location>
  3. apphome=<codebase location>
  4. processName=<Composite Name>
  5. configPlan=<Configuration plan location>
  6. description="BPEL process"
  7. serverurl=<admin server url>
  8. bpelversion=2.0

Note: we need to change the Property file name and its content for other BPEL process.


Step 4: Create Python Script

We need to create a python script file [/app/deployment/] to compile BPEL source code and create SAR file. A sample python script is as below.

  1. import os
  2. if os.environ.has_key('wlsUserID'):
  3. wlsUserID = os.environ['wlsUserID']
  4. if os.environ.has_key('wlsPassword'):
  5. wlsPassword = os.environ['wlsPassword']
  6. sca_package(apphome,processName,bpelversion,oracleHome=oraclehome)
  7. exit()

to know more about sca_package () please find below link

we need to create python script file [/app/deployment/] to deploy SAR files created from above python script after attaching configuration file created from above step.

A sample python script is as follows.

  1. import os
  2. if os.environ.has_key('wlsUserID'):
  3. wlsUserID = os.environ['wlsUserID']
  4. if os.environ.has_key('wlsPassword'):
  5. wlsPassword = os.environ['wlsPassword']
  6. connect( url='t3://cbicdg-pcp06:6001', adminServerName='soa_server1')
  7. print "server url[",serverurl,"] filename with path [",filenamewithpath,"] bpel version [",bpelversion,"] configPlan [",configPlan,"]"
  8. sca_attachPlan (filenamewithpath, configPlan,true,true)
  9. sca_deployComposite (serverurl,filenamewithpath,true)
  10. exit()

Note: Unlike property file we need not to change the python file for different BPEL processes.

To know more about sca_attachPlan(),sca_deployComposite() please visit below link

Step 5 : Create Build [Shell] script

We need to create a shell script which will execute above python scripts recursively for all interfaces. Below shell script will ask for Interface name and based on given name it will load corresponding property file and execute python Scripts.

  1. while :
  2. do
  3. echo "Enter Process Name to be build and deploy[default none]: "
  4. read processName
  5. echo /app/deployment/deploy$
  6. cp /app/oracle/product/wls1032/aia11g/aia_instances/aia11gdev/config/.adf/META-INF/adf-config.xml /app/codebase/$processName/SCA-INF/classes/META-INF
  7. export wlsttoolhome=(Location of script under SOA server installation normally it resides under wls1032/soa11g/common/bin)
  8. export wlsUserID=$1
  9. export wlsPassword=$2
  10. cd $wlsttoolhome
  11. pwd
  12. ./ -loadProperties /app/deployment/deploy$ /app/deployment/
  13. mv /app/codebase/$processName/deploy/sca\_$processName\_rev2.0.jar /app/codebase/$processName/deploy/sca_$processName.jar
  14. cp /app/codebase/$processName/deploy/sca_$processName.jar /app/deployment
  15. ./ -loadProperties /app/deployment/deploy$ /app/deployment/
  16. done
  17. exit()


If your BPEL process refer MDS storage then we need to define that location in adf-config.xml file.So proper adf-config.xml will refer proper mds. So in above shell script we copy standard adf-config.xml which comes with AIA installation to our SOA project [Please refer Line 6]


Step 6 : Modify Configuration file:

We need to Modify generic auto generated configuration plan by including searchReplace components and use the targeted instance host name and port name in search and replace component like below.



Here I assume migration happens from DEV to TEST so below places needs to changed from DEV references to TEST references.

1. In configuration file like above.

2. In property file the admin server references and Oracle home  needs to be changed based on TEST server references

3. In build script below lines needs to be modified based on Test server references.


Execute WLST utility

Execute the build script from /app/deployment and pass weblogic admin userid and weblogic admin password as argument. Before execution please give chmod 755 to that (refer step 5). Sample command for executing python script as follows

./ <weblogic userid > <password>

if prompted please give the SOA composite name.

Note: “Deploying composite success” confirms the successful deployment.