Hi,
I have been desperately trying to expose an OSGI Service as a Web
Service using Distributed OSGI for several days. I followed the
instructions on http://cxf.apache.org/distributed-osgi.html to install
the Single Distribution version and created a very basic OSGI Bundle
but unfortunately I couldn't managed to see the WSDL. Here is the log
when I start Apache Felix.
Welcome to Felix.
=================
-> HttpService using port: 8080
Jul 20, 2009 10:16:26 AM org.apache.cxf.dosgi.discovery.local.Activator start
INFO: Registering LocalDiscoveryService service object
Jul 20, 2009 10:16:29 AM org.apache.cxf.dosgi.dsw.qos.IntentMap setIntents
INFO: Injected intents:
{addressing=org.apache.cxf.ws.policy.wspolicyfeat...@21d23b,
logging=org.apache.cxf.feature.loggingfeat...@7124af,
soap=org.apache.cxf.binding.soap.soapbindingconfigurat...@1f7708,
soap.1_1=org.apache.cxf.binding.soap.soapbindingconfigurat...@1f7708,
soap.1_2=org.apache.cxf.binding.soap.soapbindingconfigurat...@1bfbfb8,
HTTP=PROVIDED}
Jul 20, 2009 10:16:29 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService addTracker
INFO: adding tracker:
org.apache.cxf.dosgi.dsw.hooks.abstractclienthook$discoverycallb...@128edf2
collection: null registered against prop:
osgi.remote.discovery.interest.interfaces
Jul 20, 2009 10:16:29 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService addTracker
INFO: adding tracker:
org.apache.cxf.dosgi.dsw.hooks.abstractclienthook$discoverycallb...@128edf2
collection: null registered against prop:
osgi.remote.discovery.interest.filters
Jul 20, 2009 10:16:29 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
triggerCallbacks
INFO: nothing to search for matches to trigger callbacks with delta: []
Jul 20, 2009 10:16:29 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
triggerCallbacks
INFO: nothing to search for matches to trigger callbacks with delta: []
Jul 20, 2009 10:16:31 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
bundleChanged
INFO: bundle changed: cxf-dosgi-ri-singlebundle-distribution
Jul 20, 2009 10:16:31 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
bundleChanged
INFO: bundle changed: org.hoydaa.echo
Jul 20, 2009 10:16:31 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
bundleChanged
INFO: bundle changed: org.hoydaa.echo
Jul 20, 2009 10:16:31 AM
org.apache.cxf.dosgi.discovery.local.LocalDiscoveryService
bundleChanged
INFO: bundle changed: org.apache.felix.framework
As you see Http Service is up and running on port 8080; and here is
the currently active bundles:
-> ps
START LEVEL 1
ID State Level Name
[ 0] [Active ] [ 0] System Bundle (1.8.0)
[ 1] [Active ] [ 1] Apache Felix Shell Service (1.2.0)
[ 2] [Active ] [ 1] Apache Felix Shell TUI (1.2.0)
[ 3] [Active ] [ 1] Apache Felix Bundle Repository (1.4.0)
[ 4] [Active ] [ 1] OSGi R4 Compendium Bundle (4.1.0)
[ 5] [Active ] [ 1] Distributed OSGi Distribution Software
Single-Bundle Distribution (1.0)
[ 24] [Active ] [ 1] Echo Bundle (1.0.0.SNAPSHOT)
Echo Bundle is a very basic bundle with the following files:
EchoService.java
=================
package org.hoydaa.echo.api;
public interface EchoService {
String echo(String text);
}
EchoService.impl
=================
package org.hoydaa.echo.impl;
import org.hoydaa.echo.api.EchoService;
public class EchoServiceImpl implements EchoService {
public String echo(String text) {
return text;
}
}
Activator.java
=================
package org.hoydaa.echo.impl;
import java.util.Dictionary;
import java.util.Hashtable;
import org.hoydaa.echo.api.EchoService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public class Activator implements BundleActivator {
private ServiceRegistration registration;
public void start(BundleContext context) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("service.exported.interfaces", "*");
props.put("service.exported.configs", "org.apache.cxf.ws");
props.put("org.apache.cxf.ws.httpservice.context", "/echo");
registration =
context.registerService(EchoService.class.getName(), new
EchoServiceImpl(), props);
}
public void stop(BundleContext context) {
registration.unregister();
}
}
pom.xml
=================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hoydaa.echo</groupId>
<artifactId>echo</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Echo Bundle</name>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Activator>org.hoydaa.echo.impl.Activator</Bundle-Activator>
<DynamicImport-Package>org.apache.cxf.dosgi.dsw.qos,org.apache.cxf</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Maven Bundle Plugin generates the following Manifest from the
configuration specified in the POM.
Manifest-Version: 1.0
Export-Package: org.hoydaa.echo.api
Private-Package: org.hoydaa.echo.impl
Built-By: utku
Tool: Bnd-0.0.311
Bundle-Name: Echo Bundle
Created-By: Apache Maven Bundle Plugin
DynamicImport-Package: org.apache.cxf.dosgi.dsw.qos,org.apache.cxf
Build-Jdk: 1.6.0_14
Bundle-Version: 1.0.0.SNAPSHOT
Bnd-LastModified: 1248074041085
Bundle-ManifestVersion: 2
Bundle-Activator: org.hoydaa.echo.impl.Activator
Bundle-SymbolicName: org.hoydaa.echo
Import-Package: org.hoydaa.echo.api,org.osgi.framework;version="1.3"
>From what I expect, WSDL should be located at
http://localhost:8080/echo?wsdl, however Jetty returns with a 404
error. Do you have any idea where might be the problem? I would be
really glad if someone helps me.