...
So the remote service is simply looked up the normal way, via the OSGi Service Registry.
How does it get there? The fact that a lookup on a service is done internally triggers a Service Registry Hook. This will go out to any registered Distributed OSGi Discovery implementations and query them for any matching services.
However, in our setup we haven't yet registered a Discovery implementation. There is an alternative, more static way to provide discovery type information, in case this info is not available via discovery. It can be specified in a OSGI-INF/remote-service/*.xml
file. This the content of the Greeter Service Consumer remote-services.xml file:
Code Block | ||||
---|---|---|---|---|
| ||||
<endpoint<service-descriptions xmlns="http://www.osgi.org/xmlns/sd/rsa/v1.0.0" xmlns:other="http://www.acme.org/xmlns/other/v1.0.0"> <service<endpoint-description> <provide<property interfacename="org"objectClass"> <array> <value>org.apache.cxf.dosgi.samples.greeter.GreeterService"GreeterService</>value> <property name="service.exported.interfaces">* </array> </property> <property name="serviceendpoint.exported.configs">org.apache.cxf.ws<id">http://localhost:9090/greeter</property> <property name="orgservice.imported.configs">org.apache.cxf.ws.address">http://localhost:9090/greeter</ws</property> </serviceendpoint-description> </serviceendpoint-descriptions> |
Let's run the consumer in Equinox, so that we have the bundles running in Equinox talking to a remoted service running in Felix!
As with Felix, we will have to load the bundle with the OSGi compendium interfaces. There's one that ships with Equinox.
...