Oracle SOA/AIA/BPEL/ESB/OSB

Oracle SOA, AIA BPEL ESB and OSB knowledge base

Monday, January 17, 2011

Deploy into MDS in weblogic 11g

I showed in previous posts how to deploy xsd artifact using deploy able application.

Here i will show you how to deploy in MDS.

- first you go to your local 11g ORACLE_HOME/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)

- 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)

- under apps you can create your xsd structure

now you are done with local setup.

you go ahead and build ant project to import them into mds. You can email me to request ant project coade :)

Actually you use common sca tool to do it and use target name importCommonServiceArtifactsIntoMds from class files provided by oracle (MDSImportTask).

depends="init"
description="imports the common wsdls/xsds into the mds store">
classname="com.otn.sample.fod.soa.util.MdsImportTask"
failonerror="true">












So this is another way of importing any artifact into MDS in 11g.

Happy coding.

DVM accesibility in WEBLOGIC 11g while migrating from 10G

Sometime back i heard my colleague asking me about migrating ESB and DVM components in 11g and how to use them.

I know lot of other people have nicely explained it in different blogs, i just wanna improve my typing :) and recall memory, so forgive for that.

Here we go...

- First you will need to export metadata from 10g to a ZIP file
-- goto ORACLE_HOME and run following command
ORACLE_HOME/export.sh metadata10g.zip
- Now transfer this ZIP file to SOA Suite 11g server and use following command to convert this ZIP to archive file
-- ant -f ant-sca-upgrade.xml upgrade-xrefdvm -Dsource=/temp/upgrade metadata10g.zip -Dtarget=/temp/upgrade/11g

This will generate a file called sca_XrefDvmFiles10g_rev1.0.jar

- Now follow below steps
a) From the Oracle JDeveloper 11g File menu, select Import, then SOA Archive into SOA Project.
b)In the Create SOA Project from SOA Archive Dialog Box, click Browse and locate the sca_XrefDvmFiles10g_rev1.0.jar file that you created previously in this procedure.
c) please make sure that the Project Name and Composite Name in the Create SOA Project from SOA Archive dialog box have the same name, which must be XrefDvmFiles10g.

- Now deploy this to weblogic server and open SOA composer and you will see this dvm over there. You can use SOA composer to change the DVM value at runtime.

Please find attached project code for DVM and to test DVM in 11g.

http://www.mediafire.com/?c3ccuxr03c0adma

Accesing XSD using deployed application in WEBLOGIC 11g

Here i will show how we can deploy an xsd based artifacts application to web logic server and access them as directory on server.

Advantage:
- One time deployment.
- any future changes are just modify the file in directory and takes effect on application
- accessible through browser

Disadvantage:
- single point failure (until unless file system is configured as fail-over detection)
- you need to change host url/port before migration VS mds xpath to access artifacts

How to:
- prepare directory system and put your xsd artifacts accordingly
- create META-INF,WEB-INF directory at top level under application folder
- under META-INF directory, create file application.xml and specify web-uri (XYZ.war) and context-root (root path from where you can access /XYZ)
- under WEB-INF directory create two files web.xml and weblogic.xml
- web.xml would be normal default file no changes
- weblogic.xml would be bet here how do you want to access your artifacts i mean through file system or just an deployed application
-- if as file system then specify virtual-directory-mapping node element and define local-path(from where you wanna access) and url-pattern (what type of url should be served from this location).

Now package your application and deploy on weblogic server.

Now you can access your artifacts from specified location and refer them in your local wsdls or anywhere. Remember to change these referential URLS while deploying on other environments.

Happy coding.

Oracle SOA 11g Managing Artifacts in Weblogic

In the recent times people asked me how do we store artifacts (XSD,WSDL,DVM or any static file) in web logic server?

Here are my thoughts:

- You can store artifacts in MDS repository (i will explain how in latter post)
- You can store artifacts in web logic server as deployed applications with virtual-directory-mapping element set in configuration file
- You can also do it through web server root directory setup

I feel second and third option is good for internet development as you can access easily your artifacts from internet.

Thursday, August 26, 2010

OSB 11g - Oracle File Adapter debatching XML

Thanks to Niall for helping our blog readers.

I have a large input file adhering to the following XSD -






Business Processing:
The SSN will only be visible in the Response for persons living in the province specified in the header – in this case Munster.

- Sample input -



Such an input file could be large e.g.

1 PersonList Header element (specifying the province we are sending the data to e.g. the Irish province of Munster) and
1000s of Person elements, containing sensitive data such as SSN or as we in Ireland say PSN. So how can we leverage SOA Suite/OSB to do this efficiently?

Throttling is available with the Oracle File adapter so let's leverage it –



I created a simple SOA Composite (File Read --> Mediator --> FileWrite) and tested with the above input.

I checked in FMW console and saw that 3 instances had been created -

Instance 1 - Header + Person 1
Instance 2 - Person 2 + Person 3
Instance 1 - Person 4

Nice that the file adapter de-batching feature which gives us the Person elements wrapped in a



The only issue here is we have to validate the Person/Province against the Header/Province and, as you can see from the above, - it isn't there!

However, we do get this PersonList wrapper, so let's leverage this but changing the XSD slightly to include the destinationProvince as an attribute of the PersonList.



The new input XML file is as follows –



When I test this using the SOA composite I get 3 instances.

e.g.



Looks good – let’s go on to OSB.

OSB
Create an OSB Project and import JCA artifacts you created in JDeveloper



Generate Proxy based on readin_file





Generate Business Service based on writeOutFile



Add a Pipeline & Route Node to the Proxy Service



Route to the Business Service



Create a variable v_PersonList and Assign the $body/exam:PersonList to it

Add a FOR EACH action to the Request Pipeline



The FOR EACH is defined as follows -



As you can see, the FOR EACH includes the following -

Log - Log the number of Persons in the Message



Log - Log the current iteration




Log - the current Person ID



IF THEN --> here we check whether the province values match. If not we need
to wipe the SSN.





Output:



Friday, November 6, 2009

SOA BPEL 11G with EJB Service

With Oracle Soa Suite 11G ( FMW11G R1 ) we can finally use the EJB adapter. This adapter can be used as a service or reference. This means we can start a BPEL process by calling a EJB session method or use an EJB to lookup or change data. Using an EJB as service or reference is very cool because it is fast ( RMI ) and we can use the same EJB's ( Multi Tier ) for your Java Web applications and your composites ( Who needs the Database Adapter now?) Here is a picture of the composite application with an EJB adapter as Service and Reference.




In this blog I will explain you first, how the SDO EJB is created and then how we use this as a Reference and as a Service
Create SDO Eclipse EJBFirst step is to create an EJB entity with Eclipselink as persistence provider. For this example I used the Employees table of the HR schema. Next step is to create an EJB Session Bean.Here is an overview of my EJB model project.



Select the Session Bean and generate a service interface on this




Now it goes totally wrong with the JDeveloper wizard 11G R1.



First step is fix the packages names of the SDO and SDOImpl classes, then we can refractor these classes and move it to the entities package. With this as result.



Select the session bean again and generate for the second time the service interface. Now we will get the WSDL.



Move the EJB WSDL and XSD to the Session bean package. With this as result.



Open the Entity XSD and change the target namespace and xmlns namespace to the same name as the package name in my case /nl/whitehorses/hr/ejb/entities/.before



after




Open the XSD of the WSDL and import the entity schema and fix the namespace.



Change /nl.whitehorses.hr.ejb.services/ to /nl/whitehorses/hr/ejb/services/ in every java, XSD or WSDL file
Create a Datasource to the HR schema in Weblogic and make sure you are using the XA Oracle Driver and target this Datasource to the Soa suite server.
Deploy the EJB to the Soa Suite instance.
Using the SDO Ejb as a reference in Soa Suite 11gOpen the composite application and drag the EJB adapter on the reference part of the composite.



Fill in the JNDI of the EJB on soa suite server , select the EJB jar and provide the Remote EJB interface class name. Select the WSDL , Go the classes folder of the EJB model project and select the Session bean WSDL. This will copy the WSDL and the XSD to the local project folders and also import the jar. That's all , now you can invoke this in a BPEL process.



Using the SDO Eclipselink Ejb as a Service in Soa Suite 11gWe can use the same EJB as starting point of our composite application. This time Soa Suite only uses the interface and does nothing with the Session Bean methods. Drag the EJB adapter to the Services side of the composite overview.



The Service ID is very important because we need this name in serviceFactory.createService, The rest is the same as in the reference part. Use this EJB Service in a BPEL process.
Now we only have to make a simple java class where we call this EJB composite service.




package nl.whitehorses.soa.ejb.service;

import commonj.sdo.helper.DataFactory;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;

import nl.whitehorses.hr.ejb.entities.EmployeesSDO;
import nl.whitehorses.hr.ejb.services.HrEmployeeEJB;

import oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceFactory;
import oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean;

import oracle.jbo.common.sdo.SDOHelper;


public class callejb {
public callejb() {
super();
}

public static void main(String[] args) {
try {
// very important to load every schema you use in the EJB
try {
SDOHelper.INSTANCE.defineSchema("nl/whitehorses/hr/ejb/entities/", "EmployeesSDO.xsd");
SDOHelper.INSTANCE.defineSchema("nl/whitehorses/hr/ejb/services/", "HrEmployeeEJBBeanWS.xsd");


} catch (Exception ex) {
ex.printStackTrace();
}

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

// soa suite server
props.put(Context.PROVIDER_URL, "t3://localhost:8001");
InitialContext ctx = new InitialContext(props);
SOAServiceInvokerBean invoker = (SOAServiceInvokerBean)ctx.lookup("SOAServiceInvokerBean#oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean");

//-- Create a SOAServiceFactory instance
SOAServiceFactory serviceFactory = SOAServiceFactory.newInstance(invoker);

// use the Service Id in the EJB service adapter
HrEmployeeEJB hrEmployeeEJB = serviceFactory.createService("EmployeeService", HrEmployeeEJB.class);



EmployeesSDO employeesSDO = ( EmployeesSDO )DataFactory.INSTANCE.create(EmployeesSDO.class);
employeesSDO.setDepartmentId(1L);
employeesSDO.setEmail("aaa@aa.nl");
employeesSDO.setEmployeeId(1L);
employeesSDO.setFirstName("edwin");
employeesSDO.setJobId("aa");
employeesSDO.setLastName("biemond");
employeesSDO.setPhoneNumber("123");
employeesSDO.setSalary(1000);

EmployeesSDO resultEmployeesSDO = hrEmployeeEJB.persistEmployeesSDO(employeesSDO);

} catch (Exception ex) {
ex.printStackTrace();
}
}


}


Here is the result of a EJB service instance.



Here the link to official EJB adapter(http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10224/sca_sdo_ejb.htm) documentation. ( This can be a lot better )
Download here the EJB project(http://www.sbsframes.nl/jdeveloper/AdfEjbHr.zip) I used and here the Soa Suite project (http://www.sbsframes.nl/jdeveloper/SoaEjbReference.zip).

How to make two BPEL process participate in Transaction

- create a BPEL process (regardless sync or async)
- create 2 invokes to 2 distinct DB partnerlinks that perform each one an
insert into 2 distinct tables

make sure 2nd invoke fails for whatever reason
- expected result would be that the transaction (insert) for the 1st invoke
should be rolled-back as well

Solution:

Make sure the DB connection are XA enabled and not MCF.

1. To make Async one way bpel process invocations to participate
in single global transaction, set bpel.xml configurations property
"deliveryPersistPolicy" to "off.immediate" and
2. To force such BPEL processes to throw un-handled BPEL faults
back to invoking process, set bpel.xml configurations property
"handleTopLevelFault" to "false".
To make sure that the all the Async one-way BPEL processes are
participating in single global transaction and all the unhandled BPEL Faults
and exceptions are propagated back to the invoking process, configure the
following in configurations section of bpel.xml:

....
off.immediate
participate
false



Also refer:

http://www.oracle.com/technology/tech/soa/pdf/oracle-soa-suite-xa-rac-guide.pdf

FEEDJIT Live Traffic Map

My Blog List