预览加载中,请您耐心等待几秒...
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

CxfSpring整合技术开发 下载相应的jar包(cxf和spring) 创建一个工程,说明一下没有必要去创建webService的工程 将1步的jar包导入(copy)lib目录下 配置web.xml文件 <?xmlversion="1.0"encoding="UTF-8"?> <web-appversion="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/beans.xml</param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 创建接口(这里就拿最简单但是又有自定义的类) 代码: packagecom.tchzt.ws.cxf.spring.cjoy.server; importjavax.jws.WebParam; importjavax.jws.WebService; importcom.tchzt.ws.cxf.spring.cjoy.server.bean.Customer; @WebService publicinterfaceHelloWorld{ StringsayHello(@WebParam(name="customer")Customercustomer); } 创建自定义类 代码: packagecom.tchzt.ws.cxf.spring.cjoy.server.bean; importjava.util.Date; importjavax.xml.bind.annotation.XmlAccessType; importjavax.xml.bind.annotation.XmlAccessorType; importjavax.xml.bind.annotation.XmlElement; importjavax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name="Customer") publicclassCustomer{ @XmlElement(nillable=true) privatelongid; @XmlElement(nillable=true) privateStringname; @XmlElement(nillable=true) privateintage; @XmlElement(nillable=true) privateDatebirthday; //get、set方法............. publicintgetAge(){ returnage; } publicvoidsetAge(intage){ this.age=age; } publicDategetBirthday(){ returnbirthday; } publicvoidsetB