IBM MQ 集成CXF 发送JMS 消息

摘要:
xmlversion=“1.0”encoding=“UTF-8”?˃˂!xmlversion=“1.0”编码
1.修改wsdl 协议类型为 jms

替换 

<soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http"/><soap:binding style="document"transport="http://cxf.apache.org/transports/jms"/>2.根据wsdl生成服务端代码,前提安装cxf,请参看 http://www.cnblogs.com/yun965861480/p/7400552.html

wsdl2java -server -impl -encoding UTF8 -d E:workwaikuaipomcxfsrcmainjava cxfEsbJmsServer.wsdl
3.配置服务端

<?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:cxf="http://cxf.apache.org/core"xmlns:soap="http://cxf.apache.org/bindings/soap"xmlns:jaxws="http://cxf.apache.org/jaxws"xmlns:jms="http://cxf.apache.org/transports/jms"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
                        http://cxf.apache.org/bindings/soap http://cxf.apache.org/schema/bindings/soap.xsd
                        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
                        http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />

    <jaxws:endpoint id="esbJmsServer"implementor="com.midea.service.fxms.abstraction.atomic.technology_esbjmsserver.v1.EsbJmsServerPortImpl"address="jms://">
                <jaxws:properties>
                        <entry key="org.apache.cxf.message.Message.ENCODING"value="UTF-8" />
                </jaxws:properties>
                <jaxws:features>
                        <bean class="org.apache.cxf.feature.LoggingFeature" />
                       
                        <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
                               <property name="jmsConfig">
                                    <ref bean="esbJmsServerJmsConfig" />
                                </property>
                        </bean>
                </jaxws:features>
                 <jaxws:inInterceptors>
                        <bean class="com.srcb.esb.interceptor.MediatorInterceptor"></bean>
                </jaxws:inInterceptors> 
        </jaxws:endpoint>

    <bean id="esbJmsServerJmsConfig"class="org.apache.cxf.transport.jms.JMSConfiguration"p:connectionFactory-ref="jmsConnectionFactory"p:targetDestination="LOCALQ.P.FXMS.REQ"
             />
             
    <bean id="jmsConfig"class="org.apache.cxf.transport.jms.JMSConfiguration"p:connectionFactory-ref="jmsConnectionFactory"p:targetDestination="LOCALQ.P.ESBPRO.REQ"
             />

    <bean id="jmsConnectionFactory"class="org.springframework.jms.connection.CachingConnectionFactory">
        <property name="targetConnectionFactory">
            <bean class="com.ibm.mq.jms.MQConnectionFactory">
                <property name="channel"value="SYSTEM.DEF.SVRCONN"></property>
                <!--MQ网关集群,多个以逗号隔开 -->
                <property name="connectionNameList"value="10.16.24.180(11101),10.16.24.181(12101)"></property>
                <property name="CCSID"value="1381"></property>
                <property name="transportType"value="1"></property>
            </bean>
        </property>
    </bean>
    

</beans>4.生成客户端代码

wsdl2java -client -impl -encoding UTF8 -d E:workwaikuaipomcxfcxf_jms_clientsrcmainjava cxfEsbJmsServer.wsdl
5.配置客户端

<?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:cxf="http://cxf.apache.org/core"xmlns:soap="http://cxf.apache.org/bindings/soap"xmlns:jaxws="http://cxf.apache.org/jaxws"xmlns:jms="http://cxf.apache.org/transports/jms"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
                        http://cxf.apache.org/bindings/soap http://cxf.apache.org/schema/bindings/soap.xsd
                        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
                        http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd">

    <import resource="classpath:META-INF/cxf/cxf.xml" />


<!--utf-8 配置,和 日志配置 -->
    <cxf:bus>
        <cxf:properties>
             <entry key="org.apache.cxf.message.Message.ENCODING"value="UTF-8" />
        </cxf:properties>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus>
    
    <jaxws:client id="esbJmsServerClient"xmlns:s="http://fxms.service.midea.com/abstraction/atomic/technology.EsbJmsServer/v1"serviceClass="com.midea.service.fxms.abstraction.atomic.technology_esbjmsserver.v1.EsbJmsServerPortType"serviceName="s:EsbJmsServer"endpointName="s:EsbJmsServerPort"wsdlLocation="classpath:cxf/EsbJmsServer.wsdl"address="jms://">
        <jaxws:properties>
            <!--修改默认的SOAP编码 -->
            <entry key="org.apache.cxf.message.Message.ENCODING"value="UTF-8" />
        </jaxws:properties>
        <jaxws:features>
            <!--增加日志特征 -->
            <bean class="org.apache.cxf.feature.LoggingFeature" />
            <!--注入JMS配置对象 -->
            <bean class="org.apache.cxf.transport.jms.JMSConfigFeature">
                <property name="jmsConfig">
                    <ref bean="ftmsJmsConfiguration" />
                </property>
            </bean>
        </jaxws:features>
    </jaxws:client>
    

    <bean id="ftmsJmsConfiguration"class="org.apache.cxf.transport.jms.JMSConfiguration"p:connectionFactory-ref="jmsConnectionFactory"p:targetDestination="LOCALQ.C.FTMS.REQ"p:replyDestination="LOCALQ.FTMS.RSP">
        <!--超时时间(ms) -->
        <property name="receiveTimeout"value="80000"></property>
        <!--消息持久性:‘1‘表示非持久;‘2‘表示持久;默认为‘2‘ -->
        <property name="deliveryMode"value="1"></property>
        <property name="explicitQosEnabled"value="true"></property>
    </bean>
    

    <bean id="jmsConnectionFactory"class="org.springframework.jms.connection.SingleConnectionFactory">
        <property name="targetConnectionFactory">
            <bean class="com.ibm.mq.jms.MQConnectionFactory">
                <property name="channel"value="SYSTEM.DEF.SVRCONN"></property>
                <!--16777216:不同队列管理器名;67108864:相同队列管理器名 -->
                <property name="clientReconnectOptions"value="16777216"></property>
                <!--队列管理器IP及PORT列表,优先连接第1个地址 -->
                <property name="connectionNameList"value="10.16.24.180(11001),10.16.24.181(12001)"></property>
<!--<property name="connectionNameList" value="10.16.12.98(11001),10.16.12.99(12001)"></property> -->
                <!--<property name="connectionNameList" value="10.16.13.122(11001)"></property> -->
<!--<property name="connectionNameList" value="10.16.10.72(11001)"></property> -->
<!--<property name="connectionNameList" value="127.0.0.1(11001)"></property> -->
                <property name="CCSID"value="1381"></property>
                <property name="transportType"value="1"></property>
            </bean>
        </property>
    </bean>
</beans>
 

免责声明:文章转载自《IBM MQ 集成CXF 发送JMS 消息》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇java倒计时三种简单实现方式System.Net.Mail.SmtpClient通过SSL/TLS协议发送邮件失败问题解决下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

springmvc常用注解标签详解【转】

转载自:http://www.cnblogs.com/leskang/p/5445698.html 1、@Controller 在SpringMVC 中,控制器Controller 负责处理由DispatcherServlet 分发的请求,它把用户请求的数据经过业务处理层处理之后封装成一个Model ,然后再把该Model 返回给对应的View 进行展示。...

C#调用WebService

1.1、Web Service基本概念 Web Service也叫XML Web Service WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独立的通讯技术。是:通过SOAP在Web上提供的软件服务,使用WSDL文件进行说明,并通过UDDI进行注册。 XML:(Extensible Mark...

ActiveMQ---知识点整理

本文来自于csdn,文章通过介绍ActiveMQ的安装,使用,搭建等等,简单整理了ActiveMQ。 本文转自:http://www.uml.org.cn/zjjs/201802111.asp 一.背景介绍 1.1 java消息服务: 不同系统之间的信息交换,是我们开发中比较常见的场景,比如系统A要把数据发送给系统B,这个问题我们应该如何去处理? 1999...

VueBlog

1、数据库建表时: timestamp有两个属性,分别是CURRENT_TIMESTAMP 和ON UPDATE CURRENT_TIMESTAMP两种,使用情况分别如下: 1.CURRENT_TIMESTAMP  当要向数据库执行insert操作时,如果有个timestamp字段属性设为  CURRENT_TIMESTAMP,则无论这个字段有木有set值...

Java(多)线程中注入Spring的Bean

问题说明 今天在web应用中用到了Java多线程的技术来并发处理一些业务,但在执行时一直会报NullPointerException的错误,问题定位了一下发现是线程中的Spring bean没有被注入,bean对象的值为null。 原因分析 web容器在启动应用时,并没有提前将线程中的bean注入(在线程启动前,web容易也是无法感知的) 解决方案 方法有...

Postgresql pg_dump

pg_dump 命令详解 参数 描述 -h 指定服务器名称 -p 指定端口 -U 指定要连接的用户名 -w/--no-password 从不提示密码 -W/--password 强制pg_dump在连接到一个数据库之前提示密码 --role=rolename 该设置会导致在连接到数据库时发布一个set role rolename...