Monday 26 September 2011

Installing ANT on Windows XP

I found the following quick instruction for installing ANT 1.7.0 on Windows XP.

  • Download ANT 1.7.0 from Apache ANT
  • Unzip the zip file and put it in some folder (for example c:\ant)
  • Set ANT_HOME environment variable to the Ant location
  • (MyComputer -> Properties -> Advanced -> Environment Variables -> User Variables for Administrator -> Set New Variable Name as "ANT_HOME" and set New Variable Value as C:\ant)
  • Now set Path variable to point to your ANT bin directory (User Variables for Administrator -> Click on Path variable -> Append the ANT bin directory location, say %ANT_HOME%\bin)
  • Open a command prompt and type "ant", you should see ANT is working now. In case of any problem try the command to print value of ANT_HOME - echo %ANT_HOME% and see the value for ANT_HOME

I see the big problem here. Let’s say next year a new version of ANT 1.7.1 will be released with great improvement or weird bug fixes. What is the owner of manual above is going to do? I think the manual’s writer will just upgrade content of c:/ant/ folder with a new version, but what if new ANT 1.7.1 version will be not compatible with already existing ANT script, but in the same time you want to try a new version and migrate your script from ANT 1.7.0 to let's say ANT 1.8.0. In my case I still use ANT 1.6.5 for a few scripts, but would like to use ANT 1.7.0 for new ones.

I posted my solution for installing ANT 1.7.0 on Windows XP below:

  • Download ANT 1.7.0 from Apache ANT
  • Unzip the zip file and put it in the version specific folder (for example F:\apps\apache-ant-1.7.0)
  • Create batch file setant170.bat with the following content in your usual working folder
@echo off
set ANT_HOME=F:\apps\apache-ant-1.7.0\
set PATH=%PATH%;%ANT_HOME%\bin
  • Open a command prompt, navigate to working folder and run setant170.bat
  • To verify installation run ANT in command promty and you should see Buildfile: build.xml does not exist!
    Build failed

Of course as soon as you close the command prompt window you will lose the ANT_HOME value, but is still very convenient, because now you can jump between different versions on ANT without problems. You just need to install a new ANT release and create one more batch file.

Any comments?

How to Install ANT in Windows XP

source: Instalasi ANT di Windows XP (Indonesia Version)

1.First,You must have JDK installed first.
2.Get the ANT for windows here:
choose latest version with zip package
3.After download ANT,extract zip package in (for example) C:\Ant

4.Set ANT_HOME
  • Right click My Computer icon
  • Choose properties
  • Choose Advanced Tab
  • Choose Environtmen Variables Button
  • In the System Variables, click New Button
  • Give the Variable Name:ANT_HOME
    Give the Value: C:\Ant
  • Click OK
  • Then,we’ll add new ANT_HOME path,
Find PATH in the Variable Column in System variables frame
  • After found, click Edit button
  • Then, add the following text in the bottom of Variable value:
    1%ANT_HOME%\bin;
  • Click OK to finish
5.Check wheter ANT works correctly or not.
In the command prompt, type:
1ant -version
then click enter,
if the result text is something like:
1Apache Ant version 1.7.1 compiled on June 27 2008
then your ANT is work correctly on your Windows
6.The end.

Installing and Deploying Demo Application


  1. Extract Foundation Pack Demo under <AIA_HOME>.
  2. If not already done so, set environment variables:
    • For Linux (bash shell)
      source <AIA_HOME>/aia_instances/<aia_instance>/bin/aiaenv.sh</aia_instance>
    • For Windows
      Navigate to aiaenv.bat located in <AIA_HOME>\aia_instances\<aia_instance>\bin
      Run aiaenv.bat
  3. You may have to assign higher memory values in your JVM parameter settings for demo to deploy if you have not set the maximum possible value already. Use the following three steps as guidance to configure JVM parameters:

    1. Navigate to <Middleware home>\user_projects\domains\<domain_name>\bin
    2. Update the following parameter in the setSOADomainEnv.sh (for Linux) and setSOADomainEnv.cmd (for Windows) file:
      • USER_MEM_ARGS="-Xms2048m -Xmx2048m -XX:PermSize=256m -
        XX:MaxPermSize=512m -XX:AppendRatio=3 -XX:NewSize=1228m -XX:MaxNewSize=1228m
        -XX:SurvivorRatio=10"
      • Note: These are recommended values while using Sun JVM. Actual values that you set depend on your system configurations. When running on dedicated hosts, you can set the JVM heap size as high as possible. Higher value results in better performance. However this number is constrained by the operating system's addressable memory space.
    3. Restart SOA server
  4. Run the deployment script:

    At the command line prompt, run the following command for your platform:
    • For Linux:
      cd $AIA_HOME/samples/AIADemo/config
      ant -f deployDemo.xml
       
    • For Windows:
      cd %AIA_HOME%\samples\AIADemo\config
      ant –f deployDemo.xml  
  5. Perform post deployment steps:

    Steps 4a and 4b are relevant only if you are going to run the B2B flows within the demo.

    1. Create writeable directories:
      • Navigate to <Middleware Home> \user_projects\domains\soa_domain\
      • Create a folder called AIA_B2B
      • Navigate to AIA_B2B and create a folder called channels.
      • Navigate to channels and create a folder called GlobalChips and a folder called Acme
      • Under each of these folders create two folders: in and out. (Both directories must be writeable.)
    1. Enable Listening Channels
      • Open B2B Server console at http://<server>:<port>/b2b and login
      • Navigate to Administration, Listening Channel and for each listening channel listed on the page.
      • Click Listening Channel row.
      • Click Channel Attributes sub-tab
      • Select Enable Channel.
      • Click Save.
    1. Set JTA Timeout:
      • Open WLS console and login.
      • Navigate to Services - JTA
      • Increase Timeout Seconds to 120.
      • Click Save.
  6. Verify Demo Deployment.

    1. Check the installation log file, <AIA_HOME>\aia_instances\<INSTANCE>\logs\AIADemoInstall.log
    2. Access the following URL: http:<server-name>:<port>/ StoreFrontModule/faces/home
    3. Select some items and add them to the cart. Total value should be less than $2000
    4. Select the Checkout link
    5. Log in with username: ngreenbe password: welcome1
    6. Click Submit Order
    7. Open Enterprise Manager SOA console and verify that multiple SOA composites were launched and that they all ran successfully.
    8. Back in the StoreFront application, click Exit and Continue Shopping
    9. Click Registration
    10. On the registration screen, provide the mandatory information and also first name and last name.(jsmith, Jill, Smith, jsmith@example.com, (415)111-2222, Female, Single, Electronics and Games)
    11. Click Next (4 times) and click Register as a Customer
    12. Verify in the Enterprise manager SOA console that 5 additional SOA composites were instantiated and executed successfully.

    Upgrading the Foundation Pack Demo
    If Foundation Pack Demo 11g Release 1 (11.1.1.2.0/11.1.1.4.0) is installed, perform the following task to upgrade to Foundation Pack Demo 11g Release 1 (11.1.1.5.0):
  1. Source aiaenv.sh from <AIA_HOME>/aia_instances/<aia_instance>/bin.  
  2. Browse to the <AIA_HOME>/Infrastructure/Install/AID folder.  
  3. Execute the following script:
    ant -f AIAInstallDriver.xml -
    DDeploymentPlan=$AIA_HOME/AIAFPUpdates/Update_AIAFP11115/config/Update_DemoInstall
    DP.xml -DPropertiesFile=$AIA_INSTANCE/config/AIAInstallProperties.xml

Test your services with AIA CAVS

Composite Application Validation System (CAVS) is part of the Application Integration Architecture Foundation Pack and with CAVS you can test your SOA Composites like SOAPUI or the SOA Test Suite. SOAPUI can test your composite services and it can mock an other service but you need to redeploy some composites to override the endpoints ( so it uses the mocked services endpoints ). The SOA Test Suite is also Ok but is focused to 1 composite. An AIA Process usually contains many composites. So for AIA you need a Test framework who can send a request and can simulate some Composite adapter references services and without redeploying any composites. CAVS can do this for you.
In every Application Business Connector Service (ABCS) of your AIA Process you can do a redirect to a simulator. In this blogpost I will show you how this works. I start with a simple test of a service, grouping some tests together, simulate a service and combine tests and simulators with CAVS routing.

First we start with a simple Test of a SOA Composite Service.
Go the AIA Homepage and press the go button in the Composite Application Validation System window.



Test definition

 In the definitions tab you can see your already defined tests and simulators. Press the Create Test button.
Provide the details. Add the endpoint of the Service you want to test. With Get Operations you can select an operation. To generate a test message press Get Messages.

Add a request between the cavs:CAVSRequestInput_1 element, you can add more then one request. Add a  cavs:CAVSRequestInput_2 element etc.
Provide the matching Response messages in the matching cavs:CAVSResponseOutput_X element.
Important press Generate Xpath so it will generate the validation rules for this test.
 Provide all the namespaces you use in this test.
When you pressed Generate Xpath on the response window you can see all the validations rules ( these based on the response message)  You can add your own.
 You are ready to test your service. Select your test and press Execute.
 In the instance tab you can see the result.

Group Definition
With a Group Definition you can combine test definitions to one group test
Assign some test defintions to this group definition.

You can execute the group definition and look at the instances tab for the results.

Simulation Definition
With a simulation you can for example emulate an reference adapter service of a Provider ABCS. To make an simulator go to the definition tab and press the create simulator button. Provide the values
Add the expected request messages you can receive in this simulator, start with cavs:CAVSRequestInput_1, you can add more expected messages use the right cavs:CAVSRequestInput_X element. Press Generate Xpath for the validation entries.
 Provide the response messages of this simulator.
 Provide the namespaces.
When you pressed Generate Xpath on the request messages then you will find some Xpath validation entries. Very important to provide the node key on every request message so CAVS can detect the right request message and give back the matching response. In my case 122 is the unique identifier.

The simulator part is finished, now you can assign this simulator to a ABCS.

When you create an ABCS with the JDeveloper AIA service constructor, it will create a AIAServiceConfigurationProperties.xml file. This file contains the endpoint url's and if it needs to route the reference to a CAVS simulator.

The AIA deployment framework will add this AIAServiceConfigurationProperties to the AIAConfigurationProperties.xml file  ( located in AIA_Home\aia_instances\AIA_Instance\AIAMetaData\config )

and also located in the MDS in the config folder

To route every request to a simulator you need to go the AIA homepage and press the Go button of the setup  window. Go the AIA Configuration Tab.
 Press add on the ABCS you want to add a simulator to it and select a simulator
 Enable the Route To CAVS option
When you open the AIAConfigurationProperties.xml you can see that the ABCS properties are changed

The changed ABCS entry.


The last part is to combine Testing and Simulation by making an Routing Setup.


Routing Setup
In a Routing Setup you can add particular simulation to one or  more ABCS and use this in a test definition.
Create a Routing Setup
 Add a simulator to the ABCS.
 And open the Test definition and lookup the Routing Setup

This will set the simulator on the ABCS's before the test is executed.

That's all and hope this gives you a quickstart in the AIA CAVS tool.

How to setup MetaData Store (MDS) for Weblogic 11g in Jdeveloper

SOA Suite 11g has a provision for sharing SOA artifacts through MDS – Meta Data Store. This facilitates greater re-use of SOA artifacts such as XML Schemas, EBMs, WSDLs, Fault Policies, Rule repositories and Service Data Objects (SDOs) among others. MDS can be file-based or database-based. Here are the steps to create and use Databased and file-based MDS in JDeveloper.
MDS is created under <jdeveloper-home>/integration/seed directory. Default folder “soa” is used to store common system soa artifacts. All custom artifacts are supposed to be stored under a folder called “apps”, since this folder already exists in server.
Create directory structure under apps folder. In my case, I’ve created folder structure ../apps/cosdeaia/ApplicationConnectorServiceLibrary to store XML schema files. This ideally should match your schema structure.
1. First you go to your local 11g Jdeveloper installation folder. In my case it is C:\JDEV_HOME11.1.1.3\jdeveloper\integration\ folder (if you have already applied third party plugin patch provided by oracle then you will see seed folder by default with all previous configuration done). If not create a seed folder under integration folder.
2. Now create folder with name apps under seed (remember to create folder with name apps else you might face issue this oracle documents say i didn’t try out).
3. Under apps you can create your folder structure to place all your XSD, WSDL files.
4. We can create a SOA_MDS connection in Jdeveloper as below -
New Connections — > SOA-MDS Connection
5. The SOA-MDS connection can be created in two ways. One is File Based MDS and other is Data Based MDS.
MDS Setup
6. In Create SOA_MDS Connection window, select File Based MDS as Connection              Type for file based MDS connection, we will point to the local folder in our system               where all the WSDL and XSD files are placed as shown below. So when we use the wsdl         and xsd files in the  project, they will be referred from the local system.
MDS Setup
7. Click OK. Now the File Based MDS connection is created.
8. Lets see how to create DB based MDS connection. In Create SOA_MDS Connection window, select DB Based MDS as Connection Type for file based MDS connection.
9. For DB Based MDS connection, we should have created all the schema for the weblogic in the database by running the Repository Creation Utility (RCU) wizard. After RCU execution, the DEV_MDS schema will get created in the database. We need to use the DEV_MDS schema connection and soa-infra as MDS Partition while creating the DB Based MDS connection as shown in the above screen shot.
10. Click OK. Now the DB Based MDS connection is created.
11. So when we use the wsdl and xsd files in the project, they will be referred from the local system. But when we deploy the application into Weblogic server, the wsdl and xsd file references will be missing. To avoid this we need to use an Ant script and import all the WSDL and XSD files into Weblogic server.
12. You use common sca tool (common-sca-tools.xml) to do it and use Ant target name importCommonServiceArtifactsIntoMds from class files provided by oracle (MDSImportTask).
13. So whenever we made modifications or additions to the WSDL or XSD files, we need to update the Weblogic server. While update, by using an Ant script first delete all the files from Weblogic server and execute re-import Ant script the latest files into Weblogic server.
14. After Import into Weblogic server, you can use the wsdl and xsd files in your project by referring to the Weblogic server through SOA-MDS (Data Based MDS) connection type. But never Copy these files into your project while referring from Weblogic server. By copying this creates a mess in run time. For example while working you do some modifications in the local WSDL and XSD files and you will forgot to update these changes in to Weblogic server.
15. Whenever we refer the WSDL or XSD files from SOA-MDS (Data Based MDS) connection type, the location URL looks like oramds:/apps/cosdeaia/… (In my case the cosdeaia folder contains all my files…)
16. The new connection appears under the “Resource Pallette” window on right side of the Jdeveloper as shown below
Now you have created the MDS connection in Jdeveloper. You can use in in your SOA Composites.

Creating an MDS connection through JDeveloper 11g


3. Choose Database Connection:

 4. Enter your database information to your MDS as follows:
5. Go back and create a new connection, this time, choose SOA-MDS Connection:
 6. Choose "DB Based MDS", choose the connection created in the previous step, and select the "soa-infra" MDS partition:

Now, under the Resource Palette, you will notice the SOA-MDS connection under IDE Connections:
You can now reference artifacts in the MDS through your code.

Referencing DVMs (through attributes or XSL)
dvm:lookupValue('oramds:/apps/AIAMetaData/dvm/hello.dvm','Name','Jack','ID','')

Fault bindings in composite.xml
<property name="oracle.composite.faultBindingFile">oramds:/apps/AIAMetaData/faultPolicies/fault-bindings.xml</property>

Schema or WSDL import
<xsd:import namespace="http://xmlns.oracle.com/bpel" schemaLocation="oramds:/apps/AIAMetaData/AIAComponents/hello.xsd"/>

Sunday 25 September 2011

11g SOA : How to set Title for Composite

When you have thousands of transactions processed through SOA composite, it becomes almost impossible to find/audit any particular instance through EM console unless you have a way to query particular transaction through its business key.
One solution for this is to set  business key of transaction as title to the composite. Once this is done, you can use in built search functionality available in instances tab in em console.
In 11g, you can set the composite title without adding any Java embedded activity to the process definition.
Add an assign activity and set the property .
In From section,
1.select Type as “expression”
2. look for function in “Mediator Extension Functions” called setCompositeInstanceTitle
med:setCompositeInstanceTitle(concat("",<xpath for your variable>))
Note : For this to work, make sure you pass string to this function. You can either use string() or concatenate with “” to make it string as shown above.
In To section
1. Select Type as “property”.
2. select/enter : tracking.compositeInstanceTitle
Note : This property is not visible in available properties list, but will work once you add it.
More on 11g..
http://soadiscovery.blogspot.com/2011/05/oracle-fusion-middleware-patch-set-4ps4.html
http://soadiscovery.blogspot.com/2011/04/timeout-for-webservice-in-11g.html
http://soadiscovery.blogspot.com/2011/04/soa-11g-configuring-transaction-timeout.html

Installing AIA on SOA Suite 11g R1 PS3 Developer release.(ADMIN SERVER)

In this blogpost I will help you installing the new version of Application Integration Architecture Foundation Pack, which is part of the FMW 11G R1 PS3 ( 11.1.1.4.0)  release.  In a previous blogpost I already explained how to do this on PS2. With the PS3 version you will see, that Oracle improved the installation compared to PS2  and combined with the developer release of SOA Suite PS3 ( the memory footprint is less ) the PS3 version is a big improvement.
Before you can start you need to have a working SOA Suite Ps3 Weblogic domain.  I choose for  the SOA Suite for developers, in this case I have one AdminServer which runs it all.

The second thing you need to check in the Weblogic console, if all the Resource Adapters are installed and running. In my case I need to target the OracleApps Adapter to the AdminServer.
Download the AIA Foundation Pack. The AIA Service Constructor can be downloaded from JDeveloper, so you can skip this for now. Extract the software and start the installation.

You need to create a new AIA Oracle Home , AIAInstance name and use the JDK of your SOA Suite Middleware home.

Start the SOA Suite Adminserver and provide these Weblogic details in this screen

AIA got its own database schema, provide the details and the sys user / password.

Provide the MDS database schema details of your SOA Suite Domain

You can skip the Oracle Enterprise Repository screen

Here the installation begins, when a step fails you can retry the step , sometimes an another retry is enough and when it fails again you need to take a look at the logs.  You can find these logs in your new  AIA HOME + aia_instances + AIA Instance Name + logs.  When you can’t fix the problem then you can look at the AIA ANT files, these are in the config folder of your AIA Instance Name and try to do it manually.
Next step is to give the Weblogic users the required  AIA roles / groups. Go the Weblogic console and in the myrealm security realms you can add some users and add them to a AIA Role like AIALifecycleUser, AIALifecycleDeveloper and AIAApplicationUser ( CAVS)
Open a browser and go to http://XXXX:7001/AIA/faces/aiaHomeLogin.jspx to see if eveything is working, In PS3 even the setup page is working.

The last step is to configure JDeveloper 11g PS3, Go to the JDeveloper update screen and select the AIA Service Constructor.

And add the aia.jar to the SOA part of the JDeveloper preferences window, located in jdeveloper/lib folder.

That’s all

Creating and Using Custom XPath Functions

While designing BPEL Processes we run into situations where the Standard Xpath functions available to the BPEL Process just won’t come handy. The typical example of this is to insert a record into Data base for a Custom Function and this article describes creating, configuring, installing and using your own custom Xpath Function.
Custom Xpath Functions are pretty much more or less like a java code. Custom Functions can be resembled to a library of methods that you create and make available during process runtime to BPEL
Objectives
- Implement a custom function in java.
- Add the custom function java code to the server and make it available to BPEL.
- Configure Xpath-functions.xml.
- Implement custom Xpath function in BPEL Designer.
- Restart Oracle Application Server.
Let us go through step by step and achieve implementing custom Xpath function in BPEL
Implement a custom function in java
Write the java code logic as per the requirement, sample java code is here

/**
* Copyright 2008, My Company Limited All Rights Reserved.
*
* FILE : customXpathFuncImpl.java
* Description : Class used in Creating Core Logic for Custom XPath Function used in BPEL
* company : My Company Limited
* Author : anvv sharma
* Date : 04-Dec-2008
**/

package com.myCompany.eai.util;

// import packages

public class customXpathFuncImpl {

/**
* @param param1
* @param Param2
* @return String
*/

public static synchronized String customXpathFunction(String param1, String Param2) {

// Core logic to implement Custom Xpath
// Scenario to Insert a Record in Data base

try {
// establish a DB Connection
}

catch (Exception e) {

} finally {
}

return customXpathVariable;
}

}

Now create another which can called as Extension Function (creating this is optional, if you wish to merge this code in the above java file, but highly recommended)

/**
* Copyright 2008, My Company Limited All Rights Reserved.
*
* FILE : OrderCacheExtFunction.java
* Description : Class used in Creating Custom XPath Function used in BPEL
* company : My Company Limited
* Author : anvv sharma
* Date : 04-Dec-2008
**/

package com.myCompany.eai.util;

// import packages

public class CustomXpathTutorialExtFunc {
public CustomXpathTutorialExtFunc() {
}

public static class customXpathFunction {
public customXpathFunction() {
}

/**
* @param iXPathContext
* @param list
* @return
* @throws XPathFunctionException
* @throws NamingException
* @throws SQLException
*/
public synchronized Object call(IXPathContext iXPathContext, List list) throws XPathFunctionException,
NamingException, SQLException {
try {
if (list.size() != 2)
throw new XPathFunctionException("Invalid Number of Arguments required 2 arguments");

Object p1 = list.get(0); //param1
Object p2 = list.get(1); //param2

String sp1 = getParamValue(p1); //param1
String sp2 = getParamValue(p2); //param2

return customXpathFuncImpl.customXpathFunction(sp1, sp2);

} catch (XPathFunctionException e) {
throw new XPathFunctionException("Failed to initialise DatatypeFactory", e);
}
}

private String getParamValue(Object param) {
String value;
if (param instanceof Element) {
Node n = (Node)param;
value = n.getFirstChild().getNodeValue();
} else if (param instanceof Text) {
Node n = (Node)param;
value = n.getNodeValue();
} else {
value = String.valueOf(param);
}
return value;
}
}
}

The purpose of creating above java file will be discussed in step 3 & 4
Add the custom function java code to the server and make it available to BPEL
Copy the compiled class files to the server at the specified location <BPEL_HOME>/bpel/system/classes, make sure a folder by name ‘com’ already exists.
Configure Xpath-functions.xml

- Edit and append xpath-functions.xml file from the following location /bpel/system/config
- Take a backup of this file before modifying.
- Make sure you append the following lines in xpath-functions.xml file between
Edit and append xpath-functions.xml file from the following location <BPEL_HOME>/bpel/system/config
Take a backup of this file before modifying.
Make sure you append the following lines in xpath-functions.xml file between
<bpel-xpath-functions></bpel-xpath-functions>

<function id="customXpathFunction" arity="2">  <classname>com.myCompany.eai.util.CustomXpathTutorialExtFunc$customXpathFunction</classname>
  <comment>
    <![CDATA[The signature of this function is <i>util:customXpathFunction(String param1, String param2)</i>.
The arguments to the function:
<ol type="2">
<li>param1 - Description (Required)</li>
<li>param2 - Description (Required)</li>
</ol>
Returns: an XML strValue formatted string]]>
  </comment>
  <property id="namespace-uri">
    <value>http://www.oracle.com/XSL/Transform/java/com.myCompany.eai.util.customXpathFuncImpl</value>
    <comment>Namespace URI for this function</comment>
  </property>
  <property id="namespace-prefix">
    <value>util</value>
    <comment>Namespace prefix for this function</comment>
  </property>
</function>

Do not disturb the existing xpath function already defined.
If something goes wrong in this file, the server will not startup properly.

Now we discussion about the additional java file we created ‘Extension Function’.
Suppose we have an scenario were we need to add another function, [say customXpathFunctionAddln, which updates a record in DB] apart from the existing function [customXpathFunction, inserts a record in DB]
We need to create another java file by name customXpathFunctionAddln with a new namespace in xpath-functions.xml with an additional entry for customXpathFunctionAddln similar to customXpathFunction entry with a new namespace, say ‘util1’
Implement custom Xpath function in BPEL Designer.
Create a BPEL Process and implement the Custom Xpath Function in Transformation File.

<?xml version="1.0" encoding="UTF-8" ?>
<?oracle-xsl-mapper null?>
<stylesheet version="1.0"
            xmlns:util="http://www.oracle.com/XSL/Transform/java/com.myCompany.eai.util.customXpathFuncImpl">
  <template match="/">
    <orderRequest>
      <orderLineItem>
        <CRMOLIId>
          <value-of select='util:customXpathFunction(/xsdLocal:param1, xsdLocal:param2)'/>
        </CRMOLIId>
      </orderLineItem>
    </orderRequest>
  </template>
</stylesheet>

Restart Oracle Application Server
Restart the Oracle Server and related proc ’s using opmnctl command line option
/opmn/bin > ./opmnctl status
> ./opmnctl stopall
> ./opmnctl startall

Oracle Fusion, BPEL and coordination of master- and detail processes

Because of a little illness Lucas was a bit faster with the publish of his article :) but i decided to still post it on my blog.
In the new Fusion 11g, Oracle added a new extension to the bpel language for the coordination of master- and detail processes.
With this add on it is possible to relate a master process with his detail processes and give signals to each other when to start and when parts are finished.

Let’s start with building something
We created a new composite application and added 3 bpel processes to it.
The first process is the master process and this one will invoke 2 detail processes.
The idea is to let both detail process only get started when they receive a ‘signal’ from the master processes. If they receive it,
they’ll execute their own logic and when either finished or at some point they want to communicate back to the master process, they give a ‘signal’ back.
In the master process, after the the receive add the first signal
1<bpelx:signal name="doDetail1" label="doDetail1" to="details"/>
This will give the first detail process a signal so it will be able to receive
Now we need to invoke the first detail process
1<invoke name="invokeDetail"
2        inputVariable="invokeDetail_process_InputVariable"
3        partnerLink="MyDetail.mydetail_client" portType="ns1:MyDetail"
4        operation="process"
5        bpelx:detailLabel="detailProcessComplete1"
6        bpelx:invokeAsDetail="true">
Two things in here are needed. The first is the bpelx:invokeAsDetail=”true” and the second is the bpelx:detailLabel=”detailProcessComplete1″
The last property is used in cases in which we have multiple detail processes and the signals need to get correlated back with the master process.
Now lets see what is needed in the first detail process to receive the signal and eventually send one back to the master process.
The first activity after the receive is the receive signal
1<bpelx:receiveSignal name="WaitOnSignalFromMaster"
2                     label="doDetail1" from="master"/>
This will receive the signal from its master process and after that will carry on. Without the signal the detail process won’t get started. So you will only be able to trigger this detail/sub process from it’s master process.
After receiving the signal the detail process can execute some logic and eventually send back the signal to the master process
1<bpelx:signal name="ReplyBackToMaster"
2              label="detailProcessComplete1" to="master"/>
In the master process we use the receiveSignal activity to receive it back from the detail process and go on with the process.
1<bpelx:receiveSignal name="waitForDetailProcess1"
2                     label="detailProcessComplete1" from="details"/>
The same code is needed to invoke the second detail process. It’s up to you to decide wether or not the second detail process can run parallel to the first one.
If this is not the case we need to wait on the receiveSignal from the first detail process before we can start the second one.

If both processes can execute their logic and eventually send the signal back we can also receive both signals on the end of the master process. If both signals are receive we can do the callback because the whole process (master and all his details have been completed).
And in this case we can invoke the detail processes like oneway processes, but still inform the master process about the state of all these oneway (long running?) processes. At the end aggregate all the signals and do the callback or some other activity which is needed as soon all the detail processes reported back.

Testcase1
What will happen if we remove one of the receiveSignals from the Master process.

the master process will wait on the receivesignal activity until it receveid it.
Testcase2
What will happen when we do not send the signal from the master process to the detail process but leave the receiveSignal in the detail process.


The master process will wait on the receiveSignal from detail process1. Since the invoke of the both detail processes are oneway and we do the ‘check’ on the receiveSignals at the end, detail process1 will just complete and send the signal back to the master process. After this the master process will keep on waiting on the signal from detail process1.
Testcase3, when all just works




Eventually the flow of the master process can look like this.
In here i placed the receiveSignals to the end of the process. You can also place them after the invokes of the detail processes, so you’re sure they will wait on each other.

Resources
Amis weblog
Tom Hofte weblog
Oracle® Fusion Middleware Developer’s Guide for Oracle SOA Suite 11g Release 1 (11.1.1) – 15 Coordinating Master and Detail Processes
JDeveloper Project

Oracle Fusion Middleware 11g (ofm11g) on Centos 5

The new Oracle Fusion Middleware 11g just got released a few days back, so time to play with it!
Oracle did a great job on the installation guide and quickstart again, so installation wasn’t a real hard job.
A short overview of the steps we need to follow
  • Install Oracle Database (i used OracleXE)
  • Create Schemas for Oracle SOA Suite and Oracle BAM by using Repository Creation Utility (RCU)
  • Install Oracle WebLogic Server and Create the Middleware Home
  • Installing Oracle SOA Suite
  • Configuring Oracle SOA Suite
  • Post-Installation Tasks
  • Installing Oracle SOA Suite Design-Time Components
On the download page i downloaded the next components
Quiet some software to install before we can get started.
I assume you already have the db running so lets get on to the next step.

Create Schemas for Oracle SOA Suite and Oracle BAM by using Repository Creation Utility (RCU)

Unzip ofm_rcu_linux_11.1.1.1.0_disk1_1of1.zip and run ./rcu
I needed to change the next parameters in the db
  • alter system set PROCESSES=500 scope=SPFILE;
  • alter system set open_cursors=500 scope=SPFILE;
And the next parameters in the linux kernel (/etc/security/limits.conf)
1# tbv oracle soa suite 11g
2oracle          hard    nofile  4096
3oracle          soft    nofile  4096
And a list of missing/wrong version of system packages
01Root
02Checking operating system certification
03Expected result: One of enterprise-4,enterprise-5,redhat-4,redhat-5,SuSE-10
04Actual Result: redhat-5
05Check complete. The overall result of this check is: Passed
06 
07Checking recommended operating system packages
08Checking for gcc-4.1.0-28.4; Not found. Failed &lt;&lt;&lt;&lt;
09Checking for gcc-c++-4.1.0-28.4; Not found. Failed &lt;&lt;&lt;&lt;
10Checking for setarch-1.6-1; found setarch-2.0-1.1-i386. Passed
11Checking for sysstat-5.0.5-1; Not found.  Failed &lt;&lt;&lt;&lt;
12Checking for libstdc++-4.1.0-28.4; found libstdc++-4.1.2-44.el5-i386. Passed
13Checking for libstdc++-devel-4.1.0-28.4; Not found. Failed &lt;&lt;&lt;&lt;
14Checking for compat-libstdc++-296-2.96-132.7.2; Not found.  Failed &lt;&lt;&lt;&lt;
15Checking for compat-db-4.1.25-9; Not found. Failed &lt;&lt;&lt;&lt;
16Checking for control-center-2.8.0-12; found control-center-1:2.16.0-16.el5-i386.  Passed
17Checking for glibc-common-2.3.4-2.9; found glibc-common-2.5-34-i386.  Passed
18Checking for binutils-2.16.91.0.5-23.4; found binutils-2.17.50.0.6-9.el5-i386.  Passed
19Checking for make-3.80-202.2; found make-1:3.81-3.el5-i386. Passed
20Check complete. The overall result of this check is: Failed &lt;&lt;&lt;&lt;
21Checking kernel parameters
22Checking for VERSION=2.6.18; found VERSION=2.6.18-128.1.16.el5. Passed
23Checking for hardnofiles=4096; hardnofiles=1024.  Failed &lt;&lt;&lt;&lt;
24Checking for softnofiles=4096; softnofiles=1024.  Failed &lt;&lt;&lt;&lt;
25Check complete. The overall result of this check is: Failed &lt;&lt;&lt;&lt;
26Checking Recommended glibc version
27Expected result: ATLEAST=2.5-12
28Actual Result: 2.5-34
29Check complete. The overall result of this check is: Passed
30 
31Checking physical memory
32Expected result: 1024MB
33Actual Result: 1196MB
34Check complete. The overall result of this check is: Passed
Install all the correct packages (yum available/yum install), and ignore the other warnings during install.
rcu1
rcu2
Setup your own db instance
rcu3
rcu4
I selected just all the components
rcu5
rcu6
rcu7
rcu8
rcu9
rcu10
rcu11

Install Oracle WebLogic Server and Create the Middleware Home

chmod the bin file and run ./oepe11_wls1031_linux32.bin
I had some ‘wrong class version exceptions’, so installed java6 update14.
wls1
Create a new home
wls2
wls3
wls4
wls5
wls6
wls7
wls8
wls9
wls10
wls11

Installing Oracle SOA Suite

Unzip ofm_soa_generic_11.1.1.1.0_disk1_1of1.zip and run ./runInstaller in Disk1
soa1
soa2
soa3

Configuring Oracle SOA Suite

Now we need to configure the soa suite installation with the Oracle Fusion Middleware Configuration Wizard.
Go to
1<ORACLE_HOME>/common/bin
and run ./config.sh
soaconfig1
soaconfig2
soaconfig3
Since i used 1 db for all the components, select al the components and config the same db settings
soaconfig4
soaconfig5
soaconfig6
soaconfig7
soaconfig8
soaconfig9
soaconfig10
soaconfig11
soaconfig12
soaconfig13
soaconfig14
soaconfig15
soaconfig16
soaconfig17
Most of the steps are just next, next and a few more next.

Post-Installation Tasks

Start both the AdminServer and the ManagedServers.
AdminServer
1<SOASUITE_HOME>/user_projects/domains/domain_name/startWebLogic.sh
ManagedServers
1<SOASUITE_HOME>/user_projects/domains/domain_name/bin/startManagedWebLogic.sh soa_server1 (default name)
2<SOASUITE_HOME>/user_projects/domains/domain_name/bin/startManagedWebLogic.sh bam_server1 (default name)
On startup it will prompt you for the username/password we used on during installation

Installing Oracle SOA Suite Design-Time Components

For development we will download Oracle JDeveloper 11g R1 (Build 5407).
To be able to create soa projects in it we need to update it with the Oracle SOA Suite Extension.
Go to Help > Check for Updates. Select ‘Oracle Fusion Middleware Products’ in the ‘Search Update Centers’, next and select ‘Oracle SOA Suite Composite Editor 11.1.1.0′.

New consoles (look-and-feel)

weblogic server 10.3.1 console
wlsconsole
enterprise manager
enterprisemanager
Installation is done!
Just a few urls to check if everything went ok
administration server
http://host:admin_server_port (default installation : http://localhost:7001)
wls console
http://host:admin_server_port/console (default installation : http://localhost:7001/console)
enterprise manager
http://host:admin_server_port/em (default installation : http://localhost:7001/em)

Links

Oracle Fusion Middleware Documentation Library
Oracle Fusion Middleware Products Update Center
Oracle11g on CentOS-5, package requirements
Oracle® Fusion Middleware Quick Installation Guide for Oracle SOA Suite11g Release 1 (11.1.1)
Ready to create some nice new fusion apps!

Oracle BPEL Fault Policy Framework handling custom business faults

From the Oracle forum and from the comments on my article about Oracle BPEL Fault Policy Management i get a lot of questions about how to let the framework handle my own custom defined ‘business faults’.
In certain situations the default set of faults defined by Oracle aren’t suited enough and you need to define your own faults.
If we look into the examples which got supplied by Oracle we can see an example over here. In this example they defined their own NegativeCredit-fault.
The Oracle BPEL Fault Policy Framework by default only handles the faults which are getting returned on an invoke-activity.
So we have our own custom fault and the knowledge we can only let this fault getting catched by the framework by use of an invoke.
So we need atleast for this testscenario 2 bpel processes. One mainprocess which calls a subprocess, and this subprocess will throw the custom business fault.
This fault will get propogated back to the mainprocess and in here we will be able to let the framework handle the fault.
bpel-invoke
BPEL Processes
Mainprocess
mainprocess
Subprocess
subprocess
Just a simple invoke of the subprocess from the mainprocess. The subprocess with throw a fault, and this fault will be catched in the mainprocess.
throwThe fault to be thrown
From the console start the mainprocess and wait till it comes back with a fault messageinvoke-faultedClick the activity to see the thrown fault
01[2009/02/13 16:24:41]
02"{http://nl.iteye/integration/faults/business}BusinessFault" has been thrown.
03 
05<part name="payload">
06    <BusinessFault xmlns="http://nl.iteye/integration/faults/business">
07      <FaultCode>999</FaultCode>
08      <FaultMessage>Something went wrong!</FaultMessage>
09    </BusinessFault>
10  </part>
11</BusinessFault>
Ok nice!
So the custom fault we defined in the subprocess reaches the mainprocess.
Now we need to config the fault policy framework so it will get active on our custom business fault.
From the fault we pasted above we need the faultname (BusinessFault) and the namespace (http://nl.iteye/integration/faults/business).
Edit /bpel/domains/default/config/fault-policies/DefaultPolicy.xml and add the next fault :
1<faultName xmlns:flt="http://nl.iteye/integration/faults/business" name="flt:BusinessFault">
2         <condition>
3                 <action ref="ora-human-intervention"/>
4         </condition>
5</faultName>
For testing we will just let this fault getting handled by human-intervention.
Now restart the components
opmnctl stopall
opmnctl startall
Now start the mainprocess again and wait till it fails.
invoke-faulted-frameworkIt looks like the framework got active (activity yellow marked) on our custom business fault.
invoke-faulted-audit
Go to the activities-tab
list-activities
And click the activity which faulted.
edit-activity
Now we can edit some of the values and let the subprocess get re-invoked.
So, at this moment we’re able to throw our custom business faults and let them getting catched by the framework. Since the fault is only getting catched on the invoke of a partnerlink, we aren’t able to let our custom business fault getting throwned to the process in which we maybe want do something with the data for which we actually throwed the custom business fault. So maybe we want to stay in the subprocess and somehow get the custome business fault thrown inhere, let the framework catch it and update the values of this subprocess with new values an re-execute the subprocess.
The next solution will get this done.
The mainprocess won’t get changed but in the subprocess we will invoke a new process called AllBusinessFaults.
New subprocess 2
subprocess2
AllBusinessFaults
all-business-faults
The AllBusinessFaults will throw the custom business fault we ‘request’ back on the invoke in this subprocess. Now it wil get catched by the framework and we will be able to change the values of the subprocess instead of the mainprocess.
list-activities2
By using the AllBusinessFaults bpel service like a sort of composite service, we can add the custom business faults in it and throw the one we would like to get thrown. This will work if the collection of custom business faults isn’t that big. I’m sure there will be better solutions for this, but for the scenario i wanted to describe inhere it was good enough for me.

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...