回答我自己的问题,
似乎不支持从 OSGi 包中创建 JAX-WS 服务的方式与 Servlet 和 REST 服务相同。
编辑:
以上说法不实,请看WASDEV forum上的贴子。尽管对于 OSGi 和 SCA,这个答案的其余部分仍然有效(尽管 SCA 的服务似乎是用 Axis2 而不是 CXF 实现的)
支持的是使用 SCA 将 OSGi 服务 公开为 SOAP 服务。
这个答案的其余部分假设:
- 您有一个 OSGi 应用程序,其中一个捆绑包通过 blueprint.xml 公开了您希望通过 SOAP 公开的服务。
- 您拥有没有 SCA 工具的 Eclipse IDE。
- 您拥有带有 Websphere 工具的 Eclipse IDE(为您提供 OSGi 工具)
- 您可以访问 WAS 控制台 Web 应用程序
这些是通过 SOAP Web 服务访问服务所需的步骤
准备 OSGi 应用程序
- 在 OSGi 应用程序项目的 APPLICATION.MF 中,使用 Application-ExportService 标头标记服务接口:
Application-ExportService: service.ExternalService
- 在包含服务的 OSGi 捆绑包的
blueprint.xml 文件中,添加 <entry key="service.exported.interfaces" value="*"/> 属性,例如:
<service id="externalService" ref="externalServiceBean" interface="ccb.service.ExternalService">
<service-properties>
<entry key="service.exported.interfaces" value="*"/>
</service-properties>
</service>
- 将项目导出为 EBA
准备 SCA 工件
- 创建一个具有以下结构的 Java 项目
/service.composite
/META-INF/sca-contribution.xml
- 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>
-
service.composite 可能如下所示:
<?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>
将项目导出为 jar
通过 WAS 控制台部署全部
- 创建新的空 BLA
应用程序 -> 应用程序类型 -> 业务级应用程序 -> 新
- 将 EBA 和 SCA jar 部署为资产
应用程序 -> 应用程序类型 -> 资产 -> 导入
-
首先添加 EBA,然后将 SCA jar 添加到业务级应用的已部署资产
应用程序 -> 应用程序类型 -> 业务级应用程序 -> [您的应用程序] -> 添加(在“已部署的资产”下)
你已经完成了!您应该在服务器的日志中看到端点 url
资源:
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