I am writing a PoC for a design based on Websphere 8.5 and OSGi.
I need to get SOAP webservices running us as an OSGi bundle and consume OSGi services exposed by other OSGi bundles within the app.
I am stuck with trying to get JAX-WS service within OSGi bundle.
What I tried so far:
Before I get too far explaining the exceptions and such. Has anybody had any joy getting JAX-WS service deployed as an OSGi bundle in Websphere 8.5? There are resources out there about doing this in Karaf, but I am restricted to Websphere.
To answer my own question,
It seems to be the case that creating JAX-WS service from within an OSGi bundle is not supported in the same way as Servlets and REST services.
Edit: The above statement is not true, please see the thread on WASDEV forum. The rest of this answer is still valid though for OSGi and SCA (though SCA's services seem to be implemented with Axis2 and not CXF)
What is supported is exposing an OSGi service as a SOAP service using SCA.
The rest of this answer assumes that:
These are the steps required to get the service accessible via SOAP web service
Preparing the OSGi application
Application-ExportService: service.ExternalService
blueprint.xml
file of the OSGi bundle with the service, add the <entry key="service.exported.interfaces" value="*"/>
property, for example:<service id="externalService" ref="externalServiceBean" interface="ccb.service.ExternalService">
<service-properties>
<entry key="service.exported.interfaces" value="*"/>
</service-properties>
</service>
Preparing The SCA artifact
/service.composite
/META-INF/sca-contribution.xml
<?xml version="1.0" encoding="UTF-8"?>
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
<deployable xmlns:ns1="http://www.example.com" composite="ns1:ServiceComposite" />
</contribution>
The service.composite
can look like this:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:scafp="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06"
targetNamespace="http://www.example.com" name="ServiceComposite">
<component name="ServiceComponent">
<scafp:implementation.osgiapp
applicationSymbolicName="[Your OSGi Application name]" applicationVersion="1.0.0" />
<service name="[maching the ID of the service in the blueprint.xml]">
<binding.ws />
</service>
</component>
</composite>
Export the project as jar
Deploying the whole lot via WAS console
Applications -> Application Types -> Business-level applications -> new
Applications -> Application Types -> Assets -> Import
Applications -> Application Types -> Business-level applications -> [Your app] -> Add (under 'Deployed assets')
You are done! You should see the endpoint url in the server's logs
Resources:
http://ianrobinson.blogspot.co.uk/2010/05/osgi-and-sca-come-together-in-websphere.html
http://www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5/com.ibm.websphere.osgi.doc/ae/ca_sca.html