Saturday 7 September 2013

HOW TO EMBED A SPRING COMPONENT IN SOA BPEL SERVICES.


The Spring component makes it possible to embed Java code as a Service Component Architecture (SCA) first-class citizen through the Spring component implementation type. Thereby the coarse-grained components of Oracle SOA Suite (such as BPEL, Mediator) can be extended by much-finer-grained Spring beans wrapped inside the Spring component.

This tutorial explains in short how to embed a spring component with SOA BPEL.

Follow the steps below sequentially

STEP 1 : Go to Jdeveloper Home Page -> Select File -> New-> Generic Project --> Click OK

STEP 2 : Provide Project Name -> Select Soa Services as shown below :





STEP 3 :  Click Next -> Select Composite With Bpel Process --> Click Finish

STEP 4 :  Select Type of Bpel you want to choose finally Click OK.Your Bpel will come as shown below.



Step 5 : On right hand side Go To Services Component Palette-> Select Spring Component --> Place it on components palette.Then Below screen will apppear .Put name and click OK.


STEP 6 : Now we need to create a java class.Go To File -> New -> All Technolgies Tab-->Select Option Java --> On right side Select Java class and click OK.The below screen appears provide details as you wish and Click OK.



STEP 7 :  On this an option will come select first one and click OK.

STEP 8 : Now a java class is created under a package.We need to write some code to make it work.

STEP 9 : Write the below snipet of code in java class section :

package com.test1;

public class mytest {
    public mytest() {
        super();
    }
    public String read(String input) {
        return "hello" + input;
    }
}

STEP 10 : Next we need to create a java interface.Click File-> New->All Technologies->Java->Select Java Interface-> Click OK.

STEP 11 : The below snippet will come.Put details as shown below and click OK.




 STEP 12 : Just Write the below lines of code and click OK.

package com.test1;

public interface Interfacetest {
    public String read(String input);
}

STEP 13 :  Go back to composite.xml. Double click on spring component.Write below lines of code .This will actuaally map bpel with java class via spring.

<!--Spring Bean definitions go here-->
    <bean class="com.test1.Interfacetest" id="impl" />
  <sca:service name="test" target="impl" type="com.test1.Interfacetest"/>
</beans>

STEP 14 : After that you will be asked to generate wsdl if you a question mark tab will come : Click OK.

STEP 15.Again you will be prompted to ask another question click OK.

STEP 16 : Your spring is ready.It will look like this :




 STEP 17 : Now double click on Bpel component.Drag an invoke activity and and an assign activity ,map invoke with spring component and you complete bpel looks like this :










STEP 18 : Double click on assign activity,map source input with spring input as shown below :



STEP 18. Our code is ready.Compile test ,deploy your services on weblogic server.

Please feel free to add your comments/queries.suggestions on any posts.


Happy Coding............

No comments:

Post a Comment