热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CXFServiceInterceptor请求,响应报文之控制台输出

一:定义接口@WebService(targetNamespace=http://www.unionpay.com/client/appprovider,name=

一:定义接口

@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 /
  /jaxws:inInterceptors
  !--
  jaxws:inInterceptors
  bean /
  /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

文章来源于https://www.cnblogs.com/rengh/p/4016199.html


推荐阅读
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 在重复造轮子的情况下用ProxyServlet反向代理来减少工作量
    像不少公司内部不同团队都会自己研发自己工具产品,当各个产品逐渐成熟,到达了一定的发展瓶颈,同时每个产品都有着自己的入口,用户 ... [详细]
  • 本文介绍了如何使用C#制作Java+Mysql+Tomcat环境安装程序,实现一键式安装。通过将JDK、Mysql、Tomcat三者制作成一个安装包,解决了客户在安装软件时的复杂配置和繁琐问题,便于管理软件版本和系统集成。具体步骤包括配置JDK环境变量和安装Mysql服务,其中使用了MySQL Server 5.5社区版和my.ini文件。安装方法为通过命令行将目录转到mysql的bin目录下,执行mysqld --install MySQL5命令。 ... [详细]
  • Imtryingtofigureoutawaytogeneratetorrentfilesfromabucket,usingtheAWSSDKforGo.我正 ... [详细]
  • Spring学习(4):Spring管理对象之间的关联关系
    本文是关于Spring学习的第四篇文章,讲述了Spring框架中管理对象之间的关联关系。文章介绍了MessageService类和MessagePrinter类的实现,并解释了它们之间的关联关系。通过学习本文,读者可以了解Spring框架中对象之间的关联关系的概念和实现方式。 ... [详细]
  • SpringMVC接收请求参数的方式总结
    本文总结了在SpringMVC开发中处理控制器参数的各种方式,包括处理使用@RequestParam注解的参数、MultipartFile类型参数和Simple类型参数的RequestParamMethodArgumentResolver,处理@RequestBody注解的参数的RequestResponseBodyMethodProcessor,以及PathVariableMapMethodArgumentResol等子类。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
    本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • springmvc学习笔记(十):控制器业务方法中通过注解实现封装Javabean接收表单提交的数据
    本文介绍了在springmvc学习笔记系列的第十篇中,控制器的业务方法中如何通过注解实现封装Javabean来接收表单提交的数据。同时还讨论了当有多个注册表单且字段完全相同时,如何将其交给同一个控制器处理。 ... [详细]
author-avatar
刘美娥94662
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有