部分银行项目有用到mq队列管理器用于消息的处理下发,该项目是通过webservice进行连接,下面是具体cxf+spring配置文件:调用只需要把相关的jar包与对应的属性进行修改即可
客户端配置如下:
<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:p="http://www.springframework.org/schema/p"
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.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" default-lazy-init="true" default-autowire="byName">
<!--p:targetDestination="queue://MQCCC/LOCALQ.SMS.SMSMTSOAP.REQ"
p:replyDestination="queue://MQCCC/LOCALQ.GSP.RSP"-->
<bean id="jmsSmsOutputConfig" class="org.apache.cxf.transport.jms.JMSConfiguration"
p:receiveTimeout="5000000"
p:connectionFactory-ref="jmsConnectionFactory"
p:targetDestination="queue://MQCCC/REMOTEQ.GSP.SMSMTSOAP.REQ"
p:replyDestination="queue://MQCCC/LOCALQ.GSP.RSP"
p:concurrentConsumers="1"
p:maxConcurrentConsumers="1000"
p:wrapInSingleConnectionFactory="true"
p:useJms11="true" />
<!--MQ 客户端配置连接信息-->
<bean id="jmsConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="channel" value="SYSTEM.DEF.SVRCONN"></property>
<property name="queueManager" value="MQCCC"></property>
<property name="hostName" value="182.119.171.65"></property>
<property name="port" value="1415"></property>
<property name="CCSID" value="1208"></property>
<property name="transportType" value="1"></property>
</bean>
</property>
<property name="sessionCacheSize" value="4"></property>
</bean>
<jaxws:client id="smsMtService" xmlns:o="http://sms.service.bankcomm.com/Abstraction/Atomic/business.smsmt.SmsMtSOAP"
serviceClass="com.incesoft.commbank.smsservice.output.SmsMt" serviceName="o:SmsMt" endpointName="o:SmsMtSOAP" address="jms://" >
<!--设置拦截器-->
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
</jaxws:outInterceptors>
<!--<property name="endpointAddress" value=""/>-->
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
<bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.cxf.transport.jms.JMSConfigFeature"
p:jmsConfig-ref="jmsSmsOutputConfig" />
<wsa:addressing/>
</jaxws:features>
</jaxws:client>
</beans>
服务器端配置如下:
<?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:p="http://www.springframework.org/schema/p"
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.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"
default-lazy-init="true" default-autowire="byName">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-local.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
<!-- targetDestination服务端监听的队列属性 -->
<bean id="jmsSmsSendConfig"
class="org.apache.cxf.transport.jms.JMSConfiguration"
p:receiveTimeout="50000"
p:connectionFactory-ref="jmsSmsSendConnectionFactory"
p:targetDestination="queue://MQCCC/LOCALQ.GSP.SMSSENDSERVICE.REQ"
p:concurrentConsumers="5" p:maxConcurrentConsumers="1000"
p:wrapInSingleConnectionFactory="true" p:useJms11="true" />
<!-- 服务器端连接配置方式连接 port:1208 UTF8 ,1380 GBK-->
<bean id="jmsSmsSendConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="channel" value="SYSTEM.DEF.SVRCONN"></property>
<property name="queueManager" value="MQCCC"></property>
<property name="hostName" value="182.119.171.65"></property>
<property name="port" value="1415"></property>
<property name="CCSID" value="1208"></property>
<property name="transportType" value="1"></property>
</bean>
</property>
<property name="sessionCacheSize" value="5"></property>
</bean>
<bean name="smsSend"
class="com.incesoft.commbank.smsservice.SmsSendServicePortTypeImpl">
<property name="robotInputservice">
<ref bean="robotInputservice" />
</property>
</bean>
<jaxws:endpoint id="smsSendService"
xmlns:customer="http://ccc.service.bankcomm.com/abstraction/atomic/business.SmsSendService/1_0"
implementor="#smsSend" address="jms://">
<jaxws:features>
<wsa:addressing
xmlns:wsa="http://cxf.apache.org/ws/addressing" />
<bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.cxf.transport.jms.JMSConfigFeature"
p:jmsConfig-ref="jmsSmsSendConfig" />
</jaxws:features>
</jaxws:endpoint>
</beans>
mq相关jar包过大,无法上传