`

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
分享到:
评论

相关推荐

    实战Web Service —— 使用Apache CXF开发Web服务的教程

    **实战Web Service与Apache CXF开发** Web服务是一种在互联网上进行通信的标准协议,它允许应用程序之间进行数据交换。Apache CXF是一个开源框架,用于构建和部署Web服务,支持多种Web服务标准,如SOAP、RESTful ...

    Apache CXF 资料搜集

    它基于WSDL(Web Services Description Language)定义服务接口,使用SOAP(Simple Object Access Protocol)进行消息传输,通过UDDI(Universal Description, Discovery, and Integration)进行服务发现。Apache ...

    apache-cxf-3.3.5

    Web Services Standards Support: CXF supports a variety of web service standards including SOAP, the Basic Profile, WSDL, WS-Addressing, WS-Policy, WS-ReliableMessaging, WS-Security, WS-SecurityPolicy,...

    apache-cxf-3.2.4-src.tar.gz

    2. **协议支持**:CXF支持多种协议,如HTTP、HTTPS、JMS(Java Message Service)和JBI(Java Business Integration)。这些协议使得CXF能够灵活地适应不同的网络环境和应用需求。 3. **数据绑定**:CXF提供了强大的...

    CXF实现WebService

    Apache CXF 是一款开源框架,专门用于实现和消费 Web Service,它支持多种协议和服务样式,如 SOAP、RESTful API,并且能够与各种编程语言和平台集成。本文将深入探讨使用 Apache CXF 实现 Web Service 的相关知识点...

    xfire开发Web Service接口详解

    Web Service是一种通过WSDL(Web服务描述语言)定义,使用SOAP(Simple Object Access Protocol)作为消息交换格式,通过UDDI(Universal Description, Discovery and Integration)进行发布和查找的服务。...

    Web_Service开发指南

    Apache CXF是目前最活跃的Web Service框架之一,它整合了XFire和Apache SOAP项目的优势。CXF不仅支持SOAP,还支持RESTful风格的服务,提供了一种统一的API来处理两种类型的Web Service。CXF的强项在于其强大的功能集...

    cxfjar包.zip

    【描述】中提到的"CXF调用Web service"是指Apache CXF框架,它是一个开源的Java框架,用于构建和消费Web服务。Web服务是一种通过互联网进行通信的软件系统,允许不同的应用程序之间进行交互。CXF提供了丰富的工具和...

    Web Service入门经典

    - **UDDI(Universal Description, Discovery, and Integration)**: UDDI 是一个目录服务,允许服务提供者注册他们的 Web Service,而服务消费者则可以查找并访问这些服务。 1. **Web Service 的特点** - **跨...

    web service入门学习笔记

    - 学习使用不同的工具,如Apache CXF或Glassfish,创建和部署Web Service。 - 实践安全方面,如WS-Security,以保护Web Service免受攻击。 通过这个简单的入门示例,你可以了解Web Service的基本工作原理。然而,...

    xfire_1.147_zol.zip 加 Web_Service学习手册(Xfire)-christian.pdf

    在Java世界里,Apache CXF、XFire(现已被CXF合并)等框架是实现Web Service的重要工具。 XFire,全称为XFire Java SOAP Framework,是一个轻量级的Web Service框架,它简化了开发过程,提供了快速构建Web Service...

    Web-Service学习手册(Xfire).docx

    1.3.3 CXF:CXF是另一个流行的开源Web Service框架,它结合了Xfire和Apache SOAP项目的优点,支持多种Web Service规范,并且可以与Spring框架无缝集成。 1.3.4 主流 Web Service 的比较 Axis适合初学者,因为它的...

    web service接口实现类

    或者,你可以使用诸如Apache CXF或Glassfish等Web服务容器来部署服务。 4. **生成WSDL**:Java服务端会自动生成一个描述服务的WSDL文件,客户端可以通过这个文件了解如何调用服务。 5. **消费Web Service**:...

    cxf经典学习资料-2

    Apache CXF是一个开源的Java框架,用于构建和部署SOAP(Simple Object Access Protocol)和RESTful(Representational State Transfer)Web服务。这份资料集合了CXF的核心概念、配置、扩展以及与其他技术的集成,...

    WebService (一) CXF 入门 HelloWorld

    Apache CXF是一个开源的Java框架,它提供了构建和部署Web服务的工具和API。CXF不仅支持SOAP,还支持RESTful服务,使得开发更加灵活。 ### 1. WebService基础知识 - **WSDL(Web Service Description Language)**...

Global site tag (gtag.js) - Google Analytics