0

I need to access an webservice in an OSGi-Environment (Equinox). I do already have the code for using the webservice as a stand-alone application.

The sample code uses Axis2 this seems to be a problem as I need to add all required libraries as separate bundles. This does not work with Axis2 because the jar files provided by the project are not prepared for OSGi.

I tried to "bundelize" the JAR files via BND but in the end the bundles do not work because of a "Package uses conflict error: org.apache.axis2.addressing"

How to I make Axis2 OSGi-aware?

Alternatively - what is a simple and fool-proof variant for accessing a (soap) webservice in Equinox (plain not Eclipse)? I already tried Apache CXF which failed because it looks like it tries to generate code at runtime and Axis2 is also very difficult as my post shows.

Robert
  • 39,162
  • 17
  • 99
  • 152
  • Can you bundle Axis2 dependencies by hand and add a hand-written manifest file? What exactly does org.apache.axis2.addressing conflict with? – Olaf May 13 '11 at 16:02
  • Good luck - axis2 requires about ten different jars and there are dozens of packages that need to be exported. Welcome to the OSGi bundle hell :( Regarding the package uses conflict I have no clue what it causes. As OSGi usually confronts you with an error message that may be caused by different causes OSGi-debugging is really a pain. – Robert May 13 '11 at 17:42
  • Regarding _uses conflict_ have a look at [this](http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/) and [this](http://blog.springsource.com/2008/11/22/diagnosing-osgi-uses-conflicts/) blog entries (just to understand - it is hard to fix!). – FrVaBe May 13 '11 at 18:54
  • I know both articles - my problem is that for the relevant bundles the Import-Package section has about 60 lines with dozens of packages declared. Additionally the hard line breaks every 80 characters make reading such a manifest very hard. Without a tool supporting that work it is nearly impossible. – Robert May 14 '11 at 11:26

1 Answers1

2

You should consider to embed the Axis2 libraries (and dependencies) into your bundle. In this case Axis2 will not be deployed as own bundle - instead the classes/jars will be copied to into your bundle.

If you are using maven to build your bundle you should have a look at the maven-bundle-plugin and the Embedding dependencies section.


I also would recommend to have a closer look if no OSGi enabled Axis2 libraries are around (I do not use it, so I don't know it but a quick search results in org.apache.axis2.osgi).

FrVaBe
  • 47,963
  • 16
  • 124
  • 157
  • The maven-bundle-plugin uses internally BND which I tried directly for generating bundles from the jar files - it did not work as I wrote in my question. – Robert May 13 '11 at 17:35
  • @Robert I did not meant to wrap each jar into an OSGi bundle but to embed ALL Axis2 jars (and dependencies) into your bundle (or at least) into a single Axis2-all wrapped bundle. Regarding the `Ìmport-Package` declaration try to use `resolution:=optional` this will let the bundle install and resolve the packages on use (so with some luck you won't need a package that can not be resolved). Nevertheless these are all _dirty_ suggestions and it will be hard work to get it done if it is not supported from scratch. I managed to go this way with less complex libraries. – FrVaBe May 13 '11 at 19:08