Monday 9 June 2008

Reverse Engineering BPEL to BPMN

As I wrote in my previous posting, I attended the Oracle BPA Suite Workshop last week in Brussels. As it goes with my thoughts, attending such a course will get my head spinning and generating all new ideas on how to use the tool, get it into propositions and where to position it in the whole IT landscape.

The last three years or so, we got into building many BPEL processes. These are mostly designed using a highly sophisticated and modern tool. It's called Microsoft Word... In about the same period a rather good alternative is developed into a great alternative: Open Office/Writer.

But what about Oracle BPA Suite. We want to use that one to do our Business Process modelling. And of course we want to have a relationship between the BPMN model and our BPEL Process. This should be great when doing impact analysis. Hey, wait a minute, this is something I missed. I hope some Oracle Product Manager reads this and puts this high on the wish-list of near-future-improvements.

To get thus far, you probably want to have your bpel-processes reverse engineered to the BPA Suite. And if possible a simple migration would be great. Well, to get the expectations right in the beginning: you can't. That is: as far as I have seen the tool. But given the current "State of the Union" I'm pretty sure I'm right.

So that's the bad side of the story. Now I probably wouldn't write this post if I have not tried it or thought further and maybe you're interested in my findings. I think it is quite possible to outline a step-approach that gives at least a connection between a BPMN model and your BPEL project. It is at leas a starting point for your reverse engineering.

I found that the step-approach consist of two phases. The bottom up-phase and then the top-down phase.

The Bottom-up phase

The bottom-up phase is, simply stated, that you create a simple BPMN model consisting of one-automated-activity surrounded by a start and an end-event. That one you'll hand over to the IT-Department and the IT-Department will merge the current bpel-process into that one. Having done that you'll end up with a BPMN-model that is of course not very usefull for modelling and documentation purposes. But it is a necessary start for the reverse-engineering process.

The phase consist of the following steps:

  1. Backup the BPEL-project, by renaming the project directory and the jDeveloper-project file to another name. For example suffix the project with "_bck". Before doing that, make sure you committed the latest changes into your version control system.
  2. In BPA Architect create a BPMN-model with the same name as the BPEL project. Also it is wise to create a proper folder structure in which you put your processes, your datagrams (Technical Terms), Application system definitions, etc.
  3. In BPMN model create a Pool with a Lane and within that a Start- and an End-event . Also an Automated Task. This Task should be of type "Abstract BPEL" (not an invoke of a service). Give the Automated Activity an input document as input and a response document as output. Of course create the proper connnections
  4. Publish it to IT (using the SOA menu).
  5. Create a new BPEL-project in jDeveloper using the BPA Server connection (I assume you know how to do that) and choose the newly created BPMN-model for it.
  6. From the source of the backuped BPEL, copy the namespaces. Replace the tns and target-namespace with the one that is in the client. Also deduplicate the namespaces.
  7. Copy the partnerlinks. Make sure there is only one client partnerlink based on the one in the backuped BPEL.
  8. Copy the rest of the project including the variables to the scope of the automated activity.
  9. Place the variables to out the sequence of the scope, the rest of the BPEL code should be within the sequence. There's probably an empty activity named the same as the Automated Activity. You can remove that one.
  10. Comment out the receive client and invoke callback-client statements. In a later step we use them to replace the generated ones in the Start and End scope.
  11. Move the input and output variables to the global scope.
  12. Move the commented receive activity to the scope belonging to the BPMN-start event and move the commented invoke/callback activyt to the scope of the BPMN-end-event.
  13. Replace the generated receive/invokes by the moved/commented ones. Mark the namespaces: they should correspond to the namespaces of the original BPEL-source. The bpel generated by the BPA-Suite connection have "tns" as a namespace. The BPEL originally created by jDeveloper have "client" as a namespace. Make sure they're both equal to the original BPEL source. They should also match with the WSDL.
    Also mark that the original ones are probably empty activities and the newly generated ones have annotations. Take care that the annotations are adapted into the resulting receive/invoke activities.
  14. Probably it is convenient to just replace the WSDL files of the new BPEL project with the original one of the backuped BPEL. Also copy al the other artefacts (WSDL's of other partnerlinks/adapters, XSD's, XSL's of transformations, etc.) to the new BPEL project. Maybe this should be done upfront.
  15. Save the project in jDeveloper.
  16. Save project to the bpa server (make sure that in BPA Architect the model is not opened).
  17. Go to the naar Architect and accept the changes from IT. For that you should deselect any detail-activity by clicking somewhere on the background of the model and the Accept and Refuse changes buttons light up.
  18. Of course try to deploy your project to the development SoaSuite and adapt possible mistakes and save the correct/deployable and correctly runnable project to both BPA Suite and your Version Control System.
The Top-Down phase
As said this will deliver you a simple BPMN model but it does consist all your technical BPEL details. In jDeveloper you could add some Abstracts in the sequence of BPMN activities and move the appropriate BPEL details to the corresponding scopes. It is however not possible to add business logic on BPMN level. You could try to rename a "locked" BPMN activity by renaming the scope. But the BPA-Suite connection will notice and refresh your BPEL source. You can only do that in the BPA suite. And that is in fact what you're going to do in the Top-Down phase. There you'll add the necessary business logic.

For each Partnerlink Invocation you'll have to add Automated Tasks with the appropriate naming, Technical Terms, Input and Output documents (resembling the input and output variables of your partnerlink-invocation) and Human Workflow activities. Of course you'll provide the necessary Business Logic.

I would suggest to do this in small steps:
  1. Add one or two Automated Tasks for appropriate Partnerlink invocation
  2. Add the necessary Business Logic Plumbing
  3. Save the model and publish it to IT
  4. In jDeveloper move the appropriate logic to the corresponding scopes and get it to work in your Development SoaSuite.
  5. Save the project in jDeveloper and in your Version Control System.
  6. Save it to BPA Suite.
Repeat these steps as often as needed to get the right granularity in your BPMN-model.
Don't change your BPMN project with all the Business Logic right away. Then it is to hard to get all the technical details moved properly ending up with a BPEL process that won't work anymore and is hardly possible to get it work ever. So add one or two Automated Activities

Unfortunatly at this time we don't have a smart one-click approach. Especially for big models it can be a monks-job. But I think it might be worth it. It'll get you to a neatly documented Business Process that can grow with your organization.
It might turn out that some of your BPEL is just to complicated. That your technical detailing is based on some technical choices that does not resemble the thoughts of the Business Analyst. That is not necessarily wrong from functional-perspective. But then it is not possible to get the whole out of it.
Also I'm not sure yet how to handle the invoke and receive of Asynchronous Services. But that gets sorted out.
And if you need help: just contact us through

No comments :