Friday, April 23, 2010

Java program to get the input xml/receive data from bpel instance

This java program helps in recover the input message for the given set of instances. The BPEL process name and instance id should be given as input in the instances.txt file as shown below.

SyncHelloWorld=370001
SyncHelloWorld=370002

BPELInstance.java

package client;

import com.oracle.bpel.client.IBPELDomainHandle;
import com.oracle.bpel.client.IInstanceHandle;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
import com.oracle.bpel.client.util.WhereCondition;

import java.io.File;
import java.io.IOException;
import java.io.StringWriter;

import java.util.Properties;
import java.util.Scanner;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import oracle.xml.parser.v2.XMLDocument;

import org.w3c.dom.NodeList;


public class BPELInstance {
public static void main(String[] args) throws ServerException,
IOException {
try {

Properties props = new Properties();
WhereCondition whCnd;
String processName;
Locator locator;
int value;

props.setProperty("orabpel.platform", "ias_10g");
props.setProperty("java.naming.factory.initial",
"com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url",
"opmn:ormi://hostname:6003:oc4j_soa/orabpel");
props.setProperty("java.naming.security.principal", "oc4jadmin");
props.setProperty("java.naming.security.credentials", "password");
props.setProperty("dedicated.connection", "true");

locator = new Locator("default", "password", props); // Provide the domain name and password
System.out.println("Connected to the Server");
File fFile =
new File("C:\\Zia\\Automation\\Client\\instances.txt");
Scanner scanner = new Scanner(fFile);
IBPELDomainHandle domain = locator.lookupDomain();
while (scanner.hasNextLine()) {
Scanner scanner1 = new Scanner(scanner.nextLine());
scanner1.useDelimiter("=");
if (scanner1.hasNext()) {
processName = scanner1.next();
value = Integer.parseInt(scanner1.next());
//System.out.println("ProcessName = " + processName + " Instance = " + value);
WhereCondition whereProcessId =
new WhereCondition("process_id = ?");
whereProcessId.setString(1, processName);
whCnd = new WhereCondition("cikey = ?");
whCnd.setInt(1, value);
whereProcessId.append("and").append(whCnd);

IInstanceHandle instances[] =
locator.listInstances(whereProcessId);
if (instances != null && instances.length > 0) {
System.out.println("*** Recovering " + processName +
"[" + value + "] ***");
String auditTrail = instances[0].getAuditTrail();
//System.out.println("\n\n"+auditTrail);
XMLDocument xmlDoc =
Utility.getXMLDocumentFromString(auditTrail);
if (xmlDoc != null) {
NodeList nodeList =
xmlDoc.selectNodes("//details[@id]");

if (nodeList != null) {
System.out.println("@@@@@@@@@" +
nodeList.getLength() +
"@@@@@@@@@");
if (nodeList.getLength() > 0) {
System.out.println("### Getting the data from AuditDetails ###");
String auditDetails =
instances[0].getAuditDetails(0);
System.out.println(auditDetails);
} else {
System.out.println("### Getting the data from AuditTrail ###");
XMLDocument xmlDoc1 =
Utility.getXMLDocumentFromString(Utility.getNodeValueByXPath(xmlDoc,
"/audit-trail/event/details/text()"));
NodeList nl =
xmlDoc1.getDocumentElement().getElementsByTagName("part");
StringWriter sw = new StringWriter();
Transformer serializer =
TransformerFactory.newInstance().newTransformer();
serializer.transform(new DOMSource(nl.item(0).getFirstChild()),
new StreamResult(sw));
String result = sw.toString();
System.out.println(result);
}
}
//System.out.println("******************* End Recovery Steps ***********************");
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Output

Connected to the Server
*** Recovering SyncHelloWorld[370001] ***
@@@@@@@@@0@@@@@@@@@
### Getting the data from AuditTrail ###
<?xml version="1.0" encoding="UTF-8"?>
<ns1:SyncHelloWorldProcessRequest xmlns:ns1="http://xmlns.oracle.com/SyncHelloWorld">
<ns1:input>JavaTest</ns1:input>
</ns1:SyncHelloWorldProcessRequest>
*** Recovering SyncHelloWorld[370002] ***
@@@@@@@@@0@@@@@@@@@
### Getting the data from AuditTrail ###
<?xml version="1.0" encoding="UTF-8"?>
<ns1:SyncHelloWorldProcessRequest xmlns:ns1="http://xmlns.oracle.com/SyncHelloWorld">
<ns1:input>OracleSoaTest</ns1:input>
</ns1:SyncHelloWorldProcessRequest>


Wednesday, April 21, 2010

Deploy JCA BRM Adapter and Create Connection Factory

This post helps in deploying the JCA BRM Adapter and Creating the connection factory in Oracle Application Server.

Deploy JCA BRM Adapter

1. Stop Application Server.

Edit application.xml file as shown below.

<import-shared-library name="oracle.bpel.common"/> tag

inside <imported-shared-libraries> tag into the following file.

<SOA_HOME>/j2ee/oc4j_soa/config/application.xml.

After adding into the application.xml it will look like this.

<!-- Comment this if you don't want to access OracleAS JMS via
the JCA framework
-->
<resource-provider class="com.evermind.server.jms.Oc4jResourceProvider"
name="oc4jjms">
<description>oc4j-jms loop back resource provider</description>
<property name="dummy" value="dummy"/>
</resource-provider>
<imported-shared-libraries>
<import-shared-library name="adf.oracle.domain"/>
<import-shared-library name="oracle.bpel.common"/>
</imported-shared-libraries>

</orion-application>

2. Start Application Server:

Without this entry BRM Adapter installation will get failed. But after successful installation of BRM adapter we have to remove this entry or else none of the BPEL or ESB processes will get loaded.

3. Deploy using Application Server Control

i) Open the AS main page, and navigate to Application Server Control (http://hostname:port/)
ii) Select the instance oc4j_soa (container where the application or AIA is running).
iii) Select Application to see the list of deployed applications
iv) Click on deploy to deploy the BRM Adapter
v) Select Adapter RAR file (OracleBRMJCA15Adapter.rar) get this rar file from BRM Administrator.














vi) Specify a valid name (name should not contain spaces, special characters etc) then click on next.















vii) Click on Deploy, optionally you can save the Deployment plan by clicking "Save Deployment Plan" and specifying a path for the .dat file.
















viii) Click Return, Once the adapter is deployed successfully.


Create Private Connection Factory


1) Click on create to create the connection factory.












2) Click on Continue









3) Set JNDI location to eis/BRM and check Use Private Connection Pool. Also provide the BRM server details(Connection String).
















4) Click Finish

BRM Adapter Post Installation Tasks

1) Stop Application Server and remove entry as below from application.xml

<SOA_HOME>/j2ee/oc4j_soa/config/application.xml file

<import-shared-library name="oracle.bpel.common"/>

2) Add below highlighted entry in oc4j-ra.xml of BRMAdapter which can be found at following location.

<SOA_HOME>/j2ee/oc4j_soa/application-deployments/default/BRMAdapter.

After adding into the oc4j-ra.xml it should look as shown below

<connector name="BRMAdapter" path="BRMAdapter.rar">
</connector>

<oc4j-connector-factories xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.oracle.com/technology/oracleas/schema/oc4j-connector-factories-10_0.xsd" schema-major-version="10" schema-minor-version="0" >
<imported-shared-libraries>
<import-shared-library name="oracle.bpel.common"/>
</imported-shared-libraries>
<connector-factory location="eis/BRM" connector-name="BRMAdapter">
<config-property name="ConnectionString" value="ip hostname 12006"/>
<config-property name="DBNumber" value="1"/>
<config-property name="PoidID" value="1"/>
<config-property name="ServiceType" value="/service/pcm_client"/>
<config-property name="LoginType" value="1"/>
<config-property name="UserName" value="root.0.0.0.1"/>
<config-property name="Password" value="&aes|08|0D5E11BFDD97D2769D9B0DBFBD1BBF7E5D40C305EDF3D77DF111AAB8F781E92122"/>
<config-property name="InputValidation" value="false"/>
<config-property name="OutputValidation" value="false"/>
<connection-pooling use="private">
<property name="waitTimeout" value="300" />
<property name="scheme" value="fixed_wait" />
<property name="maxConnections" value="50" />
<property name="minConnections" value="0" />
</connection-pooling>
<security-config use="none">
</security-config>
<connectionfactory-interface>oracle.tip.adapter.api.OracleConnectionFactory</connectionfactory-interface>
</connector-factory>
</oc4j-connector-factories>

3) Start the server again

Monday, April 19, 2010

How to change the end system(Siebel/BRM) in AIA for Communication PIP

This document helps in changing system (Siebel/BRM) of AIA for Communication PIP. This document limited only to the configuration changes in AIA and FMW to point to new end systems.


1. Prerequisites

Collect below end system information before making the changes.

Siebel :
Hostname :
PortNo :
UserName :
Password :
PriceList Id:

Siebel JMS DB Connection :
JMS Username :
JMS Password:
TNS entry of JMS Queue(DB Hostname and SID) :

BRM
Hostname :
Port :
Username:
Password:
DB Hostname:
DB Port:
DB SID:

2. AIAConfigurationProperties

Take a backup of AIAConfigurationProperties.xml located at <AIA_HOME>/config/ and start editing below datas for end system change.

Change Siebel Endpoint URI and PriceList.

<Property name="Routing.Target.Default.SiebelProductService.EndpointURI">Siebel_URI</Property>
<Property name="Siebel.PriceList.ID">1-260Z</Property>


3. Application XML Change

Make a copy of Application.xml at location <SOA_HOME>/j2ee/oc4j_soa/config/ and edit Application.xml by pasting below entries with changed values.

Siebel AIA DBConnect jms resource provider

<resource-provider name="DBConnect1" class="oracle.jms.OjmsContext">
<description>Siebel AIA DBConnect jms resource provider</description>
<property name="password" value="jmsuser" />
<property name="username" value="jmsuser" />
<property name="url" value="jdbc:oracle:oci:@(Description=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=HOST_NAME)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=service_name)))" />
</resource-provider>

4. BRMAdapter Change

Make a copy of oc4j-ra.xml at location <SOA_HOME>/j2ee/oc4j_soa/application-deployments/default/BRMAdapter/ and edit the oc4j-ra.xml with values that you need to change for the BRM system.

<config-property name="ConnectionString" value="ip 10.62.5.10 40115"/>
<config-property name="DBNumber" value="1"/>
<config-property name="PoidID" value="1"/>
<config-property name="ServiceType" value="/service/pcm_client"/>
<config-property name="LoginType" value="1"/>
<config-property name="UserName" value="root.0.0.0.1"/>

5. Data Source Change


Make a backup of data-sources.xml at location <SOA_HOME>/j2ee/oc4j_soa/config and edit the file by making changes in PortalEvenAQPool with provided BRM inputs.

<connection-pool name="PortalEventAQPool">
<connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="pin15" password="pin15" url="jdbc:oracle:thin:@HOST_NAME:1521:SID" commit-record-table-name=""/>
</connection-pool>

6. AIA Console Change

Login to AIA console http://fmw_server:7777/AIA

1) Click on Setup
2) Click on System
3) Change the endsystem connectivity