Simple Apache CXF web service integration

For those who wants to use the Apache CXF web service stack instead of Axis 1.
This guide uses the ext environment and describes how to make the remote interface of a service available as web service over Apache CXF.

If you are using the ext environment just do the following things.

1) Downlad the libraries of Apache CXF. (http://cxf.apache.org)

2) Put the following libraries into the ext-lib/portal directory:
cxf-2.2.jar
FastInfoset-1.2.2.jar
geronimo-jaxws_2.1_spec-1.0.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.9.jar
jaxb-xjc-2.1.9.jar
xmlbeans-2.3.0.jar
xml-resolver-1.2.jar
XmlSchema-1.4.4.jar

3) Generate your service code with the servicebuilder. Set the remote interface to "true" in your service.xml.

4) Create a file cxf-spring.xml in ext-impl/META-INF directory with the following content:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<simple:server id="pojoservice"
serviceClass="com.ext.portlet.reports.service.ReportsEntryService"
serviceBean="#com.ext.portlet.reports.service.ReportsEntryService.impl"
address="/reports">
<simple:dataBinding>
<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
</simple:dataBinding>
</simple:server>
</beans>

This file demonstrates how to export the ReportsEntryService interface as a web service.
Just change or add your interface and impl classes to the xml file.


5) Add the cxf-spring.xml to the portal-ext.properties. Copy the spring.config section from the portal.properties
and add the cxf-spring.xml entry. E.g.:

spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jcr-spring.xml,\
META-INF/messaging-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/search-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/document-library-spring.xml,\
META-INF/lock-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/wsrp-spring.xml,\
\
META-INF/mirage-spring.xml,\
\
META-INF/ext-spring.xml,\
META-INF/cxf-spring.xml


Thats it. Build and deploy your application. After deploying your web service is available under:
http://localhost:8080/services/<service_name>
In the example above : http://localhost:8080/services/reports

WSDL is available under:
http://localhost:8080/services/<service_name>?WSDL
In the example above : http://localhost:8080/services/reports?WSDL

Can someone confirm, I didn't missed something? emoticon
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值