01.26.06

ServiceMix JBI Container and PXE BPEL: Theory and practice..

Posted in Java, Tips and Documentation at 12:18 pm by skoobi

While speaking about a work I achieved last summer, related to ServiceMix (a JBI container) and PXE ( a BPEL engine that can be embedded inside ServiceMix), a friend of mine came up to the following conclusion :

In theory, theory and practice are the same whereas in practice, they are not.

I love that sentence :-)

So, here is a small HOWTO, taken from the email I sent to ServiceMix mailing list :

How to get a BPEL process running with ServiceMix JBI Container and Fivesight's
PXE :
===

1) The first step is to create a BPEL process with the corresponding WSDL files.
Examples bundled with PXE can serve as a quickstart.

2) Remove any concrete bindings in the WSDL Files (
binding and service XML tags). Indeed, the endpoints are JBI proxies, so the
SOAP over HTTP bindings are useless here. PXE and ServiceMix will take care of
registering ports as JBI Service endopints.

3) Compile your BPEL process and WSDL files
let's say the main WSDL file describing the process is in the
MissionPlanningProcess.wsdl (this file must import the other WSDL files that
are
used :

REM add the resources to PXE's Resources Repository MissionPlanning.rr
rradd -wsdl file:MissionPlanningProcess.wsdl MissionPlanning.rr

REM compile the BPEL
bpelc -rr MissionPlanning.rr -wsdl file:MissionPlanningProcess.wsdl
file:MissionPlanning.bpel

4) Create a pxe-system.xml file that describes how to bind the BPEL process to
actual JBI endpoints. (PXE's deployment descriptor)

Let's say that the MissionPlanning process provides 3 portTypes :
proc:ProcessPT, proc:CallbackPT, resp:ResponderPT.

We want to expose 2 services :
ProcessSVC that exposes the proc:processPT and proc:CallbackPT porttypes
and
ResponderSVC that exposes the resp:ResponderPT portType.

(same names as the Async example bundled with PXE)

the corresponding pxe-system.xml file would be :

http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.fivesight.com/pxe/system-descriptor/
http://www.fivesight.com/pxe/system-descriptor/”;
wsdlUri=”file:MissionPlanningProcess.wsdl”
xmlns=”http://www.fivesight.com/pxe/system-descriptor/”;
xmlns:proc=”uri:concordia.ciise.weather.process”
xmlns:resp=”uri:concordia.ciise.weather.responder”>







Pay attention to use the same value for the “name” attribute in the
system-descriptor tag, as the name of the BPEL process. (current limitations
with PXE, should be fixed in the future)

5) We now have all the necessary artifacts to create a SAR (System Archive) file
that is just a container for all these files :

sarcreate -common MissionPlanning.rr -sysd pxe-system.xml MissionPlanning.cbp
pxe.sar

6) JBI needs deployable components (the SAR in this case) to be contained in a
zip file. The zip file is referred later as a Service Unit. (hence the -su)

=> create the output directory
=> jar cf outputMissionPlanning-su.zip pxe.sar
(or use any tool that can create a .zip)

7) Package this service unit inside a so-called Service Assembly (SA), which is
just a set of service units with a jbi.xml
For example, create the following outputMETA-INFjbi.xml file :

http://java.sun.com/xml/ns/jbi  ./jbi.xsd”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”;
xmlns=”http://java.sun.com/xml/ns/jbi”;>

MissionPlanningSA
Service Assembly containing just the BPEL
deployment.

MissionPlanning
BPEL Service Unit

MissionPlanning-su.zip
PxeBpelEngine

and create the jar :
cd output
echo creating Service Assembly
jar cf ..MissionPlanning-sa.jar *
cd ..

component-name refers to the name of the BPEL engine deployed in the JBI
container.

8) Create a servicemix.xml file that launches a JBI container.
An example is bundled with ServiceMix’s AsyncDemo example :
Pay attention to :

and

in the installationDirPath, you will have to drop the PXE’s JBI component.
(bundled with ServiceMix). If ServiceMix doesn’t detect PXE nor install it, then
it means there is a problem in your installationDirPath. (For example, if
ServiceMix is integrated inside Geronimo, the “.” directory refers to
GERONIMO_HOME

the deploy directory is where you will drop the Service Assembly

9) launch service mix (either standalone, or by sourcing the spring file.
If you source the spring file, make sure you use ServiceMix’s Spring version.
The XML extension mechanism is not yet available from upstream Spring, so
Spring won’t recognize servicemix’s specific spring syntax.

10) Here you go, you can then talk to your BPEL process from other JBI
components (more information in another HOWTO)
I hope that this HOWTO will help someone some day...

3 Comments »

  1. jinmyliao said,

    April 13, 2006 at 4:32 pm

    I am from china ,my english is poor.I bless that this can express my thought.
    i want to devope JBIConponent that same as PXE ,the component can invoke
    web services(wsdl),but I can’t how to do it .and I will carful read this article.
    hope can owm my component.
    thank you very much!

  2. skoobi said,

    April 14, 2006 at 3:46 pm

    ServiceMix supposedly provides facilities to invoke web services. However, I’m not exactly sure on how it works.

    However, you can always create your own JBI component that will invoke a WSDL Web Service using the usual Java toolkit.. But I guess it’s not JBI-compliant ;-)

  3. jinmyliao said,

    April 14, 2006 at 4:08 pm

    hi
    Servicemix have an example of BPEL,I think this is the Component I want.
    I do component with your article guide and
    i create my component invoke BPEL,but i deploy the my component got an
    Error:
    07:57:52,203 ERROR [DeploymentService] Failed to rename C:\downfile\SOA\source\servicemix\examples\myAsBpel\.\wdir\defaultJBI
    \tmp\HelloWorld-sa.7.tmp TO C:\downfile\SOA\source\servicemix\examples\myAsBpel\.\wdir\defaultJBI\service-assemblies\HelloWorldSA
    and run the JMSClient The Servicemix server have Exception:

    javax.jbi.messaging.MessagingException: Failed to resolve endpoint: org.servicemix.jbi.NoServiceEndpointAvailableException: C
    annot find an instance of the service: {uri:fivesight.com/examples/HelloWorld}HelloService and endpoint: HelloPort

    Regards
    jinmyliao

Leave a Comment