Вопрос

I am fairly new to osgi. please be patient. I want to expose a soap webservice client as a declarative service. how do I do that. I would appreciate a step by step tutorial. I have so far been able to startup equinox, write a declarative service and consume the same service.

where I am stuck is, I expect to create a bundle containing only interface classes of the service, then create a bundle that implements the interfaces above. the implementation bundle should be the soap client so that it communicates with an external web service.

Это было полезно?

Решение

The service-registry can handle classes just as well as interfaces. That means you can expose the generated class directly as a service:

<service>
    <provide interface="your.generated.clazz"/>
</service>

This is not good practice though, for several reasons:

  1. You'd have to export the generated class from your bundle, exposing implementation details, which hurts modularity.
  2. It is not clear weather the generated class respects the OSGi service lifecycle.

Ideally, you'd write a proxy-service that uses the generated class, exposes all the OSGi-specific functions and implements the interface you want to expose.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top