Generating BPEL files programmatically?

只愿长相守 提交于 2019-12-01 04:21:05

You might want to give JAXB a try. It helps you to transform the official BPEL XSD into Java classes. You use those classes to construct your BPEL document and output it.

I had exactly the same problem with the BPELUnit [1], so I started a module in BPELUnit that has the first things necessary for generating and reading BPEL Models [2] although it is far from complete. Supported is only BPEL 2.0 (1.1 will follow later) and handlers are also currently not supported (but will be added). It is under active development because BPELUnit's code coverage component will be based on it so it will get BPEL-feature complete over time. You are happily invited to contribute if you need to close gaps earlier.

You can check it out from GitHub or grap the Maven artifact.

As of now there is no documentation but you can have a look at the JUnit tests that read and write processes.

If this is not suitable for, I'd like to share some experiences with you:

  1. Do not use JAXB: You will need to read and write XML Namespaces which are not preserved with JAXB. That's why I have chosen XMLBeans. DOM would be the other alternative that I can think of.

  2. The inheritance in the XML Schema is not really developer friendly. That's why there are own interface structures and wrappers around the XMLBeans generated classes.

Daniel

[1] http://www.bpelunit.net
[2] https://github.com/bpelunit/bpelunit/tree/master/net.bpelunit.model.bpel

The Eclipse BPEL API is based on an EMF Model. So you could generate your own artifacts using JET or Xpand based on that. This way there is no requirement to run inside Eclipse.

Although you may can't use BPEL outside of Eclipse, have you considered moving parts of your application inside it?

The BPEL XML Schemas are listed in the appendig of the spec. So you could also base your work on that and integrate with existing BPEL applications where necessary.

This has been solved using the unify framework API after adding the necessary classes to handle correlation. BPELUnit stated by @Daniel seems to be another alternative.

In case anyone is looking to solve the above problem while still running inside eclipse environment.

The problem can be resolved as stated by Luca Pino here by adding:

AdapterRegistry.INSTANCE.registerAdapterFactory( BPELPackage.eINSTANCE, BasicBPELAdapterFactory.INSTANCE );

before the resource creation line i.e.

Resource bpelResource = rSet.createResource(uri);

Note: Another solution, to the same problem, also stating how to resolve the dependencies to make this code work, can be found in my other answer here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!