With the 11g release of OSB EJB3 is supported in the EJB SB transport. Now you can use all your Remote EJB's of your Model Tier. This is not all, Oracle also added a new Transport called JEJB. This works almost the same, only now you are passing Plain Old Java Objects (POJOs) through the Service Bus. With the EJB transport the Java Web Services (JWS) framework is used ( easy for transformations ).
With JEBJ you can also use a Java Interface in a Proxy Service and expose this Proxy Service as a Remote EJB. So you can remove the existing EJB and replaced it with this Proxy Service. Or add some logging or java transformations between the Proxy Service and the original EJB in the Business Service. When you are not using a JEJB Business Service for this Proxy Service then you need to add a java callout in the response and return the right POJO. Soa Suite 11g also has this feature to expose a service as a EJB.
So lets give it a testdrive.
If your remote EJB is running on a different J2EE Server then you need to add a JNDI provider for your EJB or JEJB Business Services.
Provide the provider Url and the username / password.
Create a service interface jar of your remote EJB. ( This jar must not contain the Bean or the persistence.xml , just the entities and the remote interface ). Import this jar in your OSB project. Select File system.
Browse to your deploy folder and select the Service interface jar.
EJB Transport
Create a Business Service with a Transport Service Type.
Select the EJB protocol and use this ejb:JNDIModelTier:XXXXXX as an endpoint URI. JNDIModelTier is the name of the just created JNDI provider and XXXX is the JNDI name of your remote EJB.
In the EJB Transport Tab you need to enable EJB 3, add the service interface jar and select the remote interface.
You can enable / disable some methods or change the names of the input or output parameters.
Deploy your project to the Service Bus and test the business service in the sbconsole.
Next step is to make a Proxy Service on this Business Service. Generate and save the WSDL on this BS.
You see, there is no XML schema used in the WSDL
Use this WSDL in the proxy service and add in the Service Flow some Operation branches and use the EJB Business Service.
Deploy it and you can also test this in the sbconsole
JEJB Transport
The JEJB Transport works the same, only now, plain java object are transfered. Select JEJB as protocol and as Endpoint URI jejb:JNDIModelTier:XXXXX , JNDIModelTier is your JNDI provider and XXXX is the JNDI name of your remote EJB.
Select the EJB 3 option, add the Service Interface jar and select the remote interface.
To test it ,you can make a Proxy Service where you use JEJB as protocol. The Endpoint URI is now JEJBHr_ProxyService. You need this when you try to do a JNDI lookup of this proxy service like context.lookup("JEJBHr_ProxyService#nl.whitehorses.hr.ejb.services.HrEmployeeEJB") then a # followed by the remote interface used in this Proxy Service.
Call the JEJB Business Service and Add some Alerts in the request and response. For the request the body contains a nice XML for the response you only get a reference to the POJO. To do something with the response you need to add a java call out.
Make a EJB client and connect to the Oracle Service Bus and lookup the proxy service.
Here is the request alert with a XML presentation of the java call
And the response alert with the java reference
That's all.
Really it is huge inventory of information as it showing the up gradation of Oracle which is also added a new Transport called JEJB. This works almost the same, only now you are passing Plain Old Java Objects (POJOs) through the Service Bus.
ReplyDeleteHi Marc,
ReplyDeleteyou are right and I will be making some JEJB examples, especially how to make a response message with a java callout.
thanks
Hi,
ReplyDeleteI am new to using PoJO's in OSB. Please can you share the Jar of this OSB project so that I can do some hands on.