Pages

Monday, December 14, 2009

SCA Spring in Weblogic 10.3.2 & Soa Suite 11g Part 2

In my previous post I made a SCA Spring example and deployed this on Weblogic 10.3.2 Now it is time to use the same spring context and java sources in a Soa Suite 11g composite ( without any changes) . Keep in mind SCA Spring in WLS and the Spring Component in Soa Suite is still in preview and will be supported in Patch Set2 of Soa Suite 11g.
In this example I use the java Logger and BPEL component of Clemens OTN article.

First I copied the java sources from my Weblogic SCA Spring project to the Soa project and created for demo purposes two Spring Bean configurations.
The first has a bean with a service and a reference and the second one has only a bean with a service. ( Off course I can combine these two together in one spring bean configuration, but this is more fun)

The first spring bean configuration will just passthrough the java call. We need to remove the WS and EJB binding in the service and reference. ( Soa Suite don't need this )

<?xml version="1.0" encoding="windows-1252" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca">
<!--Spring 2.5 Bean defintions go here-->
<sca:service target="loggerPassThrough" name="LogServiceWS"
type="nl.whitehorses.wls.sca.spring.ILoggerComponent">
</sca:service>

<bean class="nl.whitehorses.wls.sca.spring.LoggerPassThrough" name="loggerPassThrough">
<property name="reference" ref="loggerEJBReference" />
</bean>

<sca:reference name="loggerEJBReference"
type="nl.whitehorses.wls.sca.spring.ILoggerComponent">
</sca:reference>

</beans>

The second spring bean configuration is the java logger. Here we also have to remove the WS binding in the service

<?xml version="1.0" encoding="windows-1252" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca">
<!--Spring 2.5 Bean defintions go here-->
<sca:service target="logger" name="LogServiceEJB"
type="nl.whitehorses.wls.sca.spring.ILoggerComponent">
</sca:service>

<bean class="nl.whitehorses.wls.sca.spring.LoggerComponentImpl" name="logger">
<property name="output" ref="loggerOutput" />
</bean>

<bean id="loggerOutput" class="nl.whitehorses.wls.sca.spring.LoggerOutput"></bean>

</beans>

Now the composite application looks like this. We need to add some wires between the BPEL and Spring Components.



Open the BPEL component and add an invoke to call the partnerlink and create the input and output variables.

Deploy the composite and test it in the Soa Suite. With this as result.
Conclusion: With the new SoaSuite Spring component it is relative easy to do a java call outs and you can exchange your SCA spring application from Weblogic to Soa Suite without any changes.

Here is my Soa Suite example workspace

No comments:

Post a Comment