On the SOA-training I’m following we’re using the Oracle SOA Suite, a very nice product, but the time needed between saving changes and deploying the process takes way too long. I also want to know exactly what’s happening and have control over the external web services. In this blog I will show you how you to deploy a process on ODE and how to use SoapUI to test a BPEL process.
Together with some colleagues we’re slowly becoming SOA-experts, we’re almost half way the SOA training and we learned a lot. Creating and deploying BPEL processes with JDeveloper is quite easy and the diagrams alone are a reason to learn BPEL
I do however have the feeling I’m not really knowing what’s happening. I want to know which files are needed for a BPEL process and have more control over the input and output. Of course I can ask the instructors which files are needed and what each file does, but it’s more educational to find out yourself.
What I needed was a simple BPEL virtual machine. My only requirements were that it had to work within a few minutes, has proper documentation and work on Tomcat. A search for BPEL engine on google gave quite some results. I picked Apache ODE because that was the easiest to pronouce. After reading the documentation and deploying the HelloWorld process it fulfilled all my requirements.
You probably think this is a strange way to pick software, but what I’m about to do will never run in a production environment and is only needed to help me develop quicker and learn more about BPEL.
Running ODE inside Tomcat
The first step is downloading ODE and deploy the war on Tomcat.
Dowload ODE here. Unzip the zip file and you will find ode.war inside the first directory. Copy this file to your Tomcat webapps directory (while Tomcat is running) and watch the log file, you should see that the BPEL Server and ODE Service are both started. Now visit http://localhost:8080/ode/ in your browser and you should see the start page:
It might be a bit strange that you see Axis 2 and not ODE, but this is ok, Axis 2 is also something with WSDL’s
BPEL processes will be listed under Services. Right now there are some admin serivces, we want to add an Hello World example.
Deploying the Hello World example
The ODE zip file ships with some examples. Of course we start with the Hello World sample. You can find this sample in the examples\HelloWorld2 directory. The testRequest.soap file is used with a command line utility to test the process. We will skip this utility because there is an easier way to test.
The deploy.xml describes how the partner link in the .bpel file is connected to the service in the .wsdl file.
HelloWorld2.bpel is the actual process. It takes an input variable and outputs it suffixed with World. The .wsdl file describes the input and output message for the process (a BPEL process is invoked just like a web service)
In a diagram this is the process:
Now that you have a basic understanding of the process it is time to deploy it. Copy the HelloWorld2 directory to the webapps\ode\WEB-INF\processes directory of your running Tomcat instance. Deploying a process takes a few seconds so you can immediately see the result on http://localhost:8080/ode/. Click on services and you should see a helloWorld process.
Righ click the helloWorld link and copy the url, you need this url to test the process.
Since a BPEL process publishes a WSDL it is easy to connect to the process. On JavaPolis I was quite impressed by SoapUI. It’s a tool for web service testing. You can give it a WSDL and it will generate an XML message which you can send to the endpoint of the WSDL. Of course the XML answer can also be reviewed.
SoapUI can be downloaded or started via Java Web Start
Click on the File menu, New WSDL Project and paste the url at the Initial WSDL text field. Give your project a useful name and click ok
After the wsdl is finished loading you see a tree. Expand the branches helloWorldSOAP12Binding and hello and double click on Request 1. soapUI now generates a request to the webservice (your Hello World process). This request is the same as the testRequest.soap we skipped earlier. You can change the details of the request. Let’s change the contents of the TestPart tag. Enter Hello instead of a question mark. Now hit the green play button to invoke the process.
The result will appear in the right pane:
<soapenv:Envelope <br /> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><br /> <soapenv:Body><br /> <axis2ns2:helloResponse <br /> xmlns:axis2ns2="http://ode/bpel/unit-test.wsdl"><br /> <TestPart <br /> xmlns:soap="http://www.w3.org/2003/05/soap-envelope" <br /> xmlns:unit="http://ode/bpel/unit-test.wsdl">Hello World</TestPart><br /> </axis2ns2:helloResponse><br /> </soapenv:Body><br /></soapenv:Envelope>
Of course this example is pretty basic, but it shows you how easy it can be to deploy and test a BPEL process.
I also tried to get my BPEL processes created with JDeveloper running inside ODE, but that wasn’t as easy as I thought. There were some challenges with name spaces and older versions of the WSDL files. I spent a lot of time analyzing the .wsdl and .bpel files to find out what went wrong. So far no results, but I learned a lot about .wsdl and .bpel. I haven’t given up on it yet, I just need a break When I found out how to do it I will write an article on this weblog about it.
With soapUI it is also possible to create test cases with asserts in it, this way you can automate the testing of your BPEL processes.
Apache ODE is a nice tool to work with. Earlier I mentioned that I’m not going to use it in a production environment, but maybe it’s mature enough to run in a production environment, I haven’t looked into that.