When we develop a BPEL process, most of the time it will connect different external (target) systems. Some times we need to use the DVMs for getting the values dynamically. So we create a DVM in the SOA server and load the DVM values file into the MDS database. Now the BPEL process has to use the SOA host dynamically to identify the DVM file path from the MDS.
So to identify the SOA server host name dynamically we can follow the below steps.
1. Create a DVM TestDVM.dvm with two columns, OrganizationId, OrganizationIdValue.
TestDVM.dvm
=============
OrganizationId | OrganizationIdValue
---------------------------------------------------
host1 abc123
host2 def234
2. Create a string variable HostName in BPEL process
3. Inside the BPEL process use a Java Embedding activity and write the below code init.
String HostName = null;
try{
InetAddress addr = InetAddress.getLocalHost();
HostName = addr.getHostName();
addAuditTrailEntry("Host name is " + HostName);
setVariableData("HostName",HostName);
} catch (Exception ex) {
ex.printStackTrace();
addAuditTrailEntry(ex.getMessage());
}
Now the value is available in the BPEL string variable.
4. If we need to use this value in the XSL files then pass the BPEL variable as input element to the XSL file.
Inside the XSL file use the DVM function to get the value.
dvm:lookupValue("TestDVM.dvm","OrganizationId",$HostName,"OrganizationIdValue",$HostName).
So to identify the SOA server host name dynamically we can follow the below steps.
1. Create a DVM TestDVM.dvm with two columns, OrganizationId, OrganizationIdValue.
TestDVM.dvm
=============
OrganizationId | OrganizationIdValue
---------------------------------------------------
host1 abc123
host2 def234
2. Create a string variable HostName in BPEL process
3. Inside the BPEL process use a Java Embedding activity and write the below code init.
String HostName = null;
try{
InetAddress addr = InetAddress.getLocalHost();
HostName = addr.getHostName();
addAuditTrailEntry("Host name is " + HostName);
setVariableData("HostName",HostName);
} catch (Exception ex) {
ex.printStackTrace();
addAuditTrailEntry(ex.getMessage());
}
Now the value is available in the BPEL string variable.
4. If we need to use this value in the XSL files then pass the BPEL variable as input element to the XSL file.
Inside the XSL file use the DVM function to get the value.
dvm:lookupValue("TestDVM.dvm","OrganizationId",$HostName,"OrganizationIdValue",$HostName).
No comments:
Post a Comment