WebService之CXF注解之五(配置文件)
1、web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
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_3_0.xsd">
<display-name>Webservice</display-name>
<!-- cfx webSerivice -->
<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>600</session-timeout>
</session-config>
</web-app>
2、cxf-servlet.xml
<?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:jaxws="http://cxf.apache.org/jaxws"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:server id="jaxwsServices" serviceClass="com.you.service.ITeacherService" address="/testTeacher">
<jaxws:serviceBean>
<bean class="com.you.service.impl.ITeacherServiceImpl" />
</jaxws:serviceBean>
</jaxws:server>
</beans>
3、运行成功结果
五月 05, 2014 11:33:44 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.you.com/}ITeacherServiceService from class com.you.service.ITeacherService
五月 05, 2014 11:33:45 下午 org.apache.cxf.services.ITeacherServiceService.ITeacherServicePort.ITeacherService
信息: Outbound Message
---------------------------
ID: 1
Address: http://localhost:8686/Webservice/services/testTeacher
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:findTeacherInfo xmlns:ns2="http://service.you.com/"><arg0><teacherAge>38</teacherAge><teacherName>李思思</teacherName><teacherNum>2007101208</teacherNum><teacherQQ>5623564545</teacherQQ><teacherSex>女</teacherSex></arg0></ns2:findTeacherInfo></soap:Body></soap:Envelope>
--------------------------------------
五月 05, 2014 11:33:45 下午 org.apache.cxf.services.ITeacherServiceService.ITeacherServicePort.ITeacherService
信息: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml;charset=UTF-8
Headers: {Content-Length=[330], content-type=[text/xml;charset=UTF-8], Date=[Mon, 05 May 2014 15:33:45 GMT], Server=[Apache-Coyote/1.1]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:findTeacherInfoResponse xmlns:ns2="http://service.you.com/"><return>教师工号:2007101208
教师名字:李思思
教师年龄:38
教师性别:女
教师QQ:5623564545</return></ns2:findTeacherInfoResponse></soap:Body></soap:Envelope>
--------------------------------------
教师工号:2007101208
教师名字:李思思
教师年龄:38
教师性别:女
教师QQ:5623564545
WebService之CXF注解之五(配置文件)的更多相关文章
- WebService之CXF注解报错(一)
WebService之CXF注解 1.详细报错例如以下 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] ...
- WebService之CXF注解报错(三)
WebService之CXF注解 1.具体错误如下 五月 04, 2014 11:29:28 下午 org.apache.cxf.wsdl.service.factory.ReflectionServ ...
- WebService之CXF注解报错(二)
WebService之CXF注解 1.具体报错如下 五月 04, 2014 11:24:12 下午 org.apache.cxf.wsdl.service.factory.ReflectionServ ...
- WebService之CXF注解之四(测试类)
TeacherTest.java: /** * @Title:TeacherTest.java * @Package:com.test.service * @Description: * @autho ...
- WebService之CXF注解之四(測试类)
TeacherTest.java: /** * @Title:TeacherTest.java * @Package:com.test.service * @Description: * @autho ...
- WebService之CXF注解之二(Service接口)
ITeacherService.java: /** * @Title:ITeacherService.java * @Package:com.you.service * @Description:教师 ...
- WebService之CXF注解之一(封装类)
Teacher.java: /** * @Title:Teacher.java * @Package:com.you.model * @Description:老师封装类 * @author:Youh ...
- WebService之CXF注解之三(Service接口实现类)
ITeacherServiceImpl.java: /** * @Title:ITeacherServiceImpl.java * @Package:com.you.service.impl * @D ...
- WebService它CXF注释错误(两)
WebService它CXF注解 1.详细报错例如以下 五月 04, 2014 11:24:12 下午 org.apache.cxf.wsdl.service.factory.ReflectionSe ...
随机推荐
- Call to undefined function mysql_connect()错误原因
从PHP5.0开始就不推荐使用mysql_connect()函数,到了php7.0则直接废弃了该函数,替代的函数是: mysqli_connect();
- ABP示例程序-使用AngularJs,ASP.NET MVC,Web API和EntityFramework创建N层的单页面Web应用
本片文章翻译自ABP在CodeProject上的一个简单示例程序,网站上的程序是用ABP之前的版本创建的,模板创建界面及工程文档有所改变,本文基于最新的模板创建.通过这个简单的示例可以对ABP有个更深 ...
- BZOJ 1025: [SCOI2009]游戏 [置换群 DP]
传送门 题意:求$n$个数组成的排列变为升序有多少种不同的步数 步数就是循环长度的$lcm$..... 那么就是求$n$划分成一些数几种不同的$lcm$咯 然后我太弱了这种$DP$都想不出来.... ...
- WPF 使用DMSkin for WPF 快速搭建漂亮的WPF程序
DMSkin-for-WPF是一个基于WPF的.Net WPF开源界面库,实现了无边框的WPF开发方案,内置部分控件模板. 你可以参照模板自行修改完善.(以下简称DFW). 核心 DFW实现了比较完美 ...
- python学习资料链接
1.入门与量化:https://www.v2ex.com/t/257297
- linux shell 执行远程命令
我在本地的shell脚本中,想要直接执行远程服务器的一个shell脚本: ssh -l root 192.168.1.1 "/data/t.sh" 记得提前给远程服务器的 /dat ...
- ansible实践3-playbook条件判断
--- - hosts: testhost user: root gather_facts: True tasks: - name: use when shell: t ...
- phpstudy如何安装景安ssl证书 window下apache服务器网站https访问
1. 下载景安免费证书 https://www.zzidc.com/help/helpDetail?id=555 2.文件解压上传至服务器,位置自己决定 3. 调整apache配置 景安原文链接:ht ...
- css为第几个倍数元素添加样式
//3n就是3的倍数都加这个样式*/.list li:nth-child(3n){ border-bottom:1px;}
- jQuery学习心得一
1.闭包 每次看到jQuery的时候,首先想到的就是闭包.这是个老生常谈的问题了.今天重新回忆了一下闭包. 什么是闭包? 当有一个函数想要访问另一个函数内部的变量,这个是访问不了的.所有我们要用闭包来 ...