CXF Service Interceptor请求,响应报文之控制台输出
一:定义接口
@WebService(targetNamespace = "http://www.unionpay.com/client/appprovider", name = "appManageToAppProvider") @XmlSeeAlso({com.cup.tsm.domain.databinding.jaxb.ObjectFactory.class, ObjectFactory.class}) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface AppManageToAppProvider {
public void GetSay(String Name);
}
二:定义接口的实现
public class AppManageToAppProviderImpl implements AppManageToAppProvider{
public void GetSay(String Name) {
System.out.println("nihao :"+Name);
}
}
三:applicationContext.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:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
default-autowire="byType" default-lazy-init="true">
<description>使用Apache CXF的Web Service配置文件,以下三个为固定配置文件(不需要创建)
</description>
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<!--在这里配置相应内容-->
<jaxws:endpoint id="sump1"
implementor="com.cup.tsm.integration.webservice.appprovider.AppManageToAppProviderImpl"
address="/appManageToAppProvider">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</jaxws:inInterceptors>
<!--
<jaxws:inInterceptors>
<bean class="com.cup.tsm.integration.webservice.appprovider.RequestInterceptor"/>
</jaxws:inInterceptors>
-->
</jaxws:endpoint>
</beans>
四:Web.xml文件
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<!-- 环境参数配置 -->
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener </listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value> /WEB-INF/applicationContext.xml </param-value>
</context-param>
<!-- CXF -->
<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>
五:创建服务端
public class AppManageToAppProvider_AppManageToAppProviderPort_Server{
protected AppManageToAppProvider_AppManageToAppProviderPort_Server() throws java.lang.Exception {
System.out.println("Starting Server");
Object implementor = new AppManageToAppProviderImpl();
String address = "http://localhost:7001/test/mtom";
Endpoint.publish(address, implementor);
}
public static void main(String args[]) throws java.lang.Exception {
new AppManageToAppProvider_AppManageToAppProviderPort_Server();
System.out.println("Server ready...");
JaxWsServerFactoryBean factory=new JaxWsServerFactoryBean();
factory.setServiceClass(AppManageToAppProviderImpl.class);
factory.setAddress("http://localhost:7001/test/mtom");
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
// Thread.sleep(5 * 60 * 1000);
// System.out.println("Server exiting");
// System.exit(0); }
六:soapui工具测试
七:控制台运行结果
《3014-03-13》--renjie
CXF Service Interceptor请求,响应报文之控制台输出的更多相关文章
- HTTP请求响应报文&&相关状态码&&GET_POST请求方法 总结
HTTP请求报文: 一个HTTP请求报文由四个部分组成:请求行.请求头部.空行.请求数据 1.请求行 请求行由请求方法字段.URL字段和HTTP协议版本字段3个字段组成,它们用空格分隔.比如 GE ...
- HTTP请求响应报文 - 相关状态码 - GET_POST请求方法
HTTP请求报文: 一个HTTP请求报文由四个部分组成:请求行.请求头部.空行.请求数据 1.请求行 请求行由请求方法字段.URL字段和HTTP协议版本字段3个字段组成,它们用空格分隔.比如 GET ...
- HTTP 请求/响应报文结构
请求报文和响应报文都是由以下4部分组成: 1.请求行/响应行 2.请求头/响应头 3.空行 4.消息主体(请求体/响应体) 请求报文结构 请求行 格式为:Method Request-URI HTTP ...
- HTTP请求/响应报文结构
HTTP协议版本有两种:HTTP1.0和HTTP1.1 它们俩的区别在于:HTTP1.0对于每个连接都只能传送一个请求和响应,请求后就会关闭,HTTP1.0没有Host字段:而HTTP1.1在同一个连 ...
- 浏览器与服务端请求响应流程与HTTP协议
浏览器与服务端请求响应流程图: 1.HTTP概要 1.1. 定义 HTTP(HyperText Transfer Protocol,超文本传输协议)最早就是计算机与计算机之间沟通的一种标准协议,这种 ...
- cxf client在后台不通且chunk设置为false的时候不能在控制台输出请求日志
场景: 服务编排框架支持编排webservice服务.call webservice的client是基于cxf做的.为了使用服务编排的开发者调试与定位问题方便,需要将webservice的请求与响应报 ...
- 关于HTTP请求报文和响应报文学习笔记
超文本传输协议(Hypertext Transfer Protocol,简称HTTP)是应用层的一种通信协议.它是一种请求/响应式的协议,即一个客户端与服务器建立连接后,向服务器发送一个请求;服务器接 ...
- http请求报文格式和响应报文格式
转载 出处 超文本传输协议(Hypertext Transfer Protocol,简称HTTP)是应用层协议.HTTP 是一种请求/响应式的协议,即一个客户端与服务器建立连接后,向服务器发送一个请求 ...
- 阿里云API网关(18)请求报文和响应报文
网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...
随机推荐
- android系统体系结构
android系统底层是建立在Linux系统之上的,如下图 从上图可以看出android系统有五部分组成 1.APPLICATIONS(应用程序层) 包含一些核心应用程序,电子邮件,日历,地图,浏览器 ...
- PL/SQL 中文转换为\uxxxx格式(unicode)
用plsql生成json的时候,经常要处理中文的情况. SELECT replace(asciistr('你好,,hello'),'\','\u') FROM dual 输出:\u4F60\u597D ...
- 在 Mac OS X 中建立加密的 Zip 压缩 -- 让机密资料加上密码
在 Mac OS X 中要压缩档案的話,基本上就用滑鼠点右鍵选「压缩...」就可以制作 Zip 格式的压缩档,很方便.但如果是机密的资料要透过 Email 等管道传送时,常常会需要建立加密的 Zip ...
- 给分类(Category)添加属性
遇到一个问题,写了一个分类,但原先类的属性不够用.添加一个属性,调用的时候崩溃了,说是找不到getter.setter方法.查了下文档发现,OC的分类允许给分类添加属性,但不会自动生成getter.s ...
- Linux下追踪函数调用,打印栈帧
事情的起因是这样的,之前同事的代码有一个内存池出现了没有回收的情况.也就是是Pop出来的对象没有Push回去,情况很难复现,所以在Pop里的打印日志,跟踪是谁调用了它,我想在GDB调试里可以追踪调用的 ...
- sec:authorize 标签 通过不通过权限例子
1. 方式一 <sec:authorize ifAnyGranted="ROLE_A"> <a href="a.jsp"> ...
- 使用PHP脚本来写Daemon程序
什么是Daemon进程 这又是一个有趣的概念,daemon在英语中是"精灵"的意思,就像我们经常在迪斯尼动画里见到的那些,有些会飞,有些不会,经常围着动画片的主人公转来转去,啰 ...
- jquery技巧(持续更新。。)
(1)集合处理功能 //为索引为0,1,2的元素分别设置不同的字体颜色 $('p').each(function(i){ this.styl ...
- 2016021901 - ubuntu截图技巧
ubuntu系统自带截图功能使用介绍 ubuntu自定义截图快捷键:Shift+PrtSc 截取当前窗口快捷键:Alt+PrtSc 保存全屏截图:PrtSc
- java入门(与C++的不同之处)封装篇
初学java,总是想将它与之前的C++做比较,看了慕客网的java入门视频,一直觉得在面向对象方面,它和C++有太多相同的地方,结果今天学到了两点不同之处,现在将它记录下来: 1. java的访问修 ...