【发布时间】:2016-01-11 13:12:57
【问题描述】:
我正在尝试在 Mule ESB(企业版)中创建一个流,该流从 WMQ 7.5(xml 有效负载)中的队列接收消息,使用 DataWeave 将其转换(出于我的目的,将其转换为一个新的 xml 文件与旧的相同),然后将其放回另一个队列。我的流程如下:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<wmq:connector (MQ configuration is here, it is not the problem) />
<flow name="dataweaveFlow">
<wmq:inbound-endpoint queue="I0" connector-ref="WMQ" doc:name="WMQ">
<wmq:transaction action="ALWAYS_BEGIN"/>
</wmq:inbound-endpoint>
<set-variable variableName="MULE_REPLYTO_STOP" value="true" doc:name="Variable"/>
<dw:transform-message doc:name="Transform Message">
<dw:input-payload doc:sample="empty_1.xml"/>
<dw:set-payload><![CDATA[%dw 1.0
%input payload application/xml
%output application/xml
---
payload]]></dw:set-payload>
</dw:transform-message>
<wmq:outbound-endpoint queue="O0" connector-ref="WMQ" doc:name="WMQ">
<wmq:transaction action="ALWAYS_JOIN"/>
</wmq:outbound-endpoint>
</flow>
</mule>
我的 DataWeave 配置如下所示: 输入:
<?xml version='1.0' encoding='windows-1252'?>
<empty/>
转换:
%dw 1.0
%input payload application/xml
%output application/xml
---
payload
现在,当我运行此流程时,我将一条消息放入队列,Mule 无法处理该消息并不断抛出异常,说:“Invalid mime type application/xml”,异常堆栈为 1。无效的 mime 类型 application/xml (com.mulesoft.weave.mule.exception.InvalidMimeTypeException) com.mulesoft.weave.mule.WeaveMessageProcessor:165 (null) 2. 无效的 mime 类型 application/xml (com.mulesoft.weave.mule.异常.InvalidMimeTypeException)。消息负载类型:String (org.mule.api.MessagingException) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
无论如何,我对 Mule(当然还有 DataWeave)还很陌生,我们将不胜感激!如果需要更多详细信息,请告诉我。
【问题讨论】:
-
你是如何运行你的骡子应用程序的?在工作室?与行家?什么骡子和工作室版本?
-
嗨 Shoki,我在没有 Maven 的工作室中运行我的 Mule 应用程序——它是 Mule 3.7.2。此外,我收到一条错误消息,提示 com.mulesoft.weave.mule.WeaveMessageProcessor: MimeType was not resolved 'application/xml' delegating to Java(我添加了一个组件来将 Mime Type 设置为 application/xml)
-
Shoki,我忘了补充——我正在使用 Anypoint Studio 5.2.0。