我需要设计一个带有xml文件的Mule流作为JMS队列的输入。一旦进入队列,它将被选中以访问SOAP Web服务。以下是代码。
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="jmsFlow2" doc:name="jmsFlow2">
<file:inbound-endpoint responseTimeout="10000" doc:name="File" path="D:\Input"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<jms:outbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS" mimeType="text/plain"/>
</flow>
<flow name="jmsFlow1" doc:name="jmsFlow1">
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<jms:jmsmessage-to-object-transformer doc:name="JMSMessage to Object"/>
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<!-- <mulexml:object-to-xml-transformer doc:name="Object to XML"/> -->
<logger message="#[message.payload]" level="INFO" doc:name="Logger"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<logger message="#[message.outboundProperties]-------#[header:Content-Type]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service serviceClass="com.org.ProcessImpl" doc:name="SOAP" enableMuleSoapHeaders="false" mtomEnabled="true">
</cxf:jaxws-service>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>
</flow>
它出现以下错误:
WARN 2014-02-06 15:27:23,145 [[jms].jmsFlow1.stage1.02]org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://com.capgemini/cif/dim}ProcessActivityService has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createSoap11Fault(SoapFaultFactory.java:58)
at org.apache.cxf.binding.soap.jms.interceptor.SoapFaultFactory.createFault(SoapFaultFactory.java:48)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.createFault(SoapJMSInInterceptor.java:226)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:191)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:49)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.handleMessage(SoapJMSInInterceptor.java:38)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:122)
at org.mule.module.cxf.CxfInboundMessageProcessor.sendToDestination(CxfInboundMessageProcessor.java:320)
at org.mule.module.cxf.CxfInboundMessageProcessor.process(CxfInboundMessageProcessor.java:142)
at org.mule.module.cxf.config.FlowConfiguringMessageProcessor.process(FlowConfiguringMessageProcessor.java:52)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.cxf.binding.soap.jms.interceptor.JMSFault: Missing ContentType.
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createFault(JMSFaultFactory.java:111)
at org.apache.cxf.binding.soap.jms.interceptor.JMSFaultFactory.createMissingContentTypeFault(JMSFaultFactory.java:72)
at org.apache.cxf.binding.soap.jms.interceptor.SoapJMSInInterceptor.checkContentType(SoapJMSInInterceptor.java:188)
... 38 more
代码中的记录器提供了正确的Content-Type,但仍然存在错误。
有人可以帮忙吗?
提前致谢
答案 0 :(得分:0)
您对Content-Type的问题可能是旧版本的问题,因为我无法重现它。
但是,如果您想使用xml数据来调用SOAP Web服务,我认为您的方法是不正确的。您应该使用代理客户端。像这样:
<jms:inbound-endpoint queue="DimQueue" connector-ref="Active_MQ" doc:name="JMS"/>
<set-property propertyName="Content-Type" value="application/soap+xml" doc:name="Property"/>
<set-property propertyName="SOAPAction" value="urn:#myMethod" doc:name="Property"/>
<cxf:proxy-client payload="envelope" doc:name="SOAP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="9090" method="POST" doc:name="HTTP">
</http:outbound-endpoint>