Friday, April 11, 2008

Undeployment of BPEL process and ESB Services

With Oracle SOA Suite and Oracle AIA the whole development process is regulated with ANT. Wir SOA Suite we were able to deploy BPEL and ESB processes. What we missed was the possibility to undeploy these services.

If you are using Oracle AIA Foundation your are able to undeploy these services. This van be done via ANT extension, which are developed along with AIA.

To undeploy a BPEL process you use the following task:

<undeployBPELProcess
User="${deploy.user}"
Password="${deploy.password}"
Domain="${bpel.domain.name}"
Process="${bpel.process.name}"
Rev="${bpel.deploy.local.version}"
Opmnrequestport="${deploy.opmnport}"
Oc4jinstancename="${deploy.oc4jname}"
hostname="${deploy.hostname}"/>
To undeploy a ESB service you use the following task:
<undeployESBEntities
esbMetadataServerHostname="${deploy.hostname}"
esbMetadataServerPort="${deploy.httpport}"
userName="${deploy.user}"
password="${deploy.password}">
<service guid="${guid}"/>
</undeployESBEntities>



Note the the GUID for the ESB service is the unique identifier of the service in the ESB system. This can be viewed in the database (wf_event).

Wednesday, April 09, 2008

Using dynamic endpoints in AIA

Oracle AIA adds some nice features on top of the Oracle SOA Suite. One of these things is using dynamic endpoints. This is a common feature in Oracle SOA Suite, but AIA makes it easier to maintain and use.

All generic properties of AIA are located in a property file. This file is called "AIAConfigurationProperties.xml". This file can be changed at runtime and can be reloaded to make it immediate available. This is done via the AIA Business Service Repository, the BSR.

Changing SOAP endpoints at runtime makes configuration management much easier. You can maintain multiple AIA configuration files for each environment; development, test and production.

To use this mechanism in your own BPEL processes the following actions must be taken:
  • Create entry in AIAConfigurationProperties.xml
  • Reload AIAConfigurationProperties.xml file
  • Import meta data xsd file in your BPEL WSDL file
  • Create namespace in BPEL file
  • Add to variables in your BPEL file
  • Retrieve end-point from AIAConfigurationProperties.xml
  • Assign entry to variable
  • Overwrite default endpoint.

Create entry in AIAConfigurationProperties.xml
Enter a new entry in the configuration file:
<ServiceConfiguration
serviceName=
"{http://namespace/MyBPELProcesNamespace}MyEndpointName">
<Property
name="Routing.Target.Default.EndpointURI">
http://hostname:port/orabpel/default/HelloWorld/HelloWorld
</Property>
</ServiceConfiguration>


Reload AIAConfigurationProperties.xml file
Goto the BSR application and reload the application config file.
  • http://hostname:portnumber/AIA
  • Goto Setup
  • Goto Configuration
  • Click on Reload
Import meta data xsd file in your BPEL WSDL file
Add the following line in your BPEL WSDL file.

<import
namespace=
"http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V1"
schemaLocation=
"http://host:port/AIAComponents/EnterpriseObjectLibrary/
Release1/Core/Common/V1/Meta.xsd"
/>

Create namespace in BPEL file
Add the following namespace defintion in your BPEL process.

xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/
Add to variables in your BPEL file
Add the following variables in your global variable declaration.

<variable name="EndpointReference" element="wsa:EndpointReference"/>
<variable name="TargetEndpointLocation" type="xsd:string"/>
Retrieve end-point and assign end-point

<scope name="Scope_GetDynamicEndpoint">
<sequence>
<bpelx:exec name="Java_GetEndPoint"
language="java" version="1.5">
<![CDATA[java.lang.String targetEndpointLocation = null;
try
{
targetEndpointLocation =
oracle.apps.aia.core.config.Configuration.getServiceProperty(
"{http://namespace/MyBPELProcesNamespace}MyEndpointName"
, "Routing.Target.Default.EndpointURI");
addAuditTrailEntry(
"Endpoint location = '"
+ targetEndpointLocation
+ "' selected from configuration properties.");
}
catch (oracle.apps.aia.core.config.PropertyNotFoundException e)
{
addAuditTrailEntry(
"Routing.Target.Default.EndpointLocation not found.");
}
if
(
targetEndpointLocation!=null
&& targetEndpointLocation!="")
{
setVariableData(
"TargetEndpointLocation"
, targetEndpointLocation);
addAuditTrailEntry("Address set.");
}]]>
</bpelx:exec>
<assign name="AssignPartnerlinkEndpointReference">
<copy>
<from>
<wsa:EndpointReference
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
<wsa:Address/>
</wsa:EndpointReference>
</from>
<to variable="EndpointReference"/>
</copy>
<copy>
<from variable="TargetEndpointLocation"/>
<to variable="EndpointReference"
query="/wsa:EndpointReference/wsa:Address"/>
</copy>
<copy>
<from variable="EndpointReference"/>
<to partnerLink="YourParterLinkName"/>
</copy>
</assign>
</sequence>
</scope>