0

我有两个试图通过 HTTP POST 连接的 Mule 流。运行时,我收到无效的子类型错误。我在下面包含了请求和 Web 服务的代码。我还包括了给出的错误。知道我做错了什么吗?

要求

<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" contentType="text/xml" doc:name="HTTP" mimeType="text/xml" path="***some path removed***" method="POST"/>

网络服务

<mule xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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" version="EE-3.3.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.xsd
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 ">

<spring:beans>
<spring:bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<spring:property name="ignoreResourceNotFound" value="true"/>
<spring:property name="locations">
<spring:list>
<spring:value>classpath:local_valueDate.properties</spring:value>
<spring:value>classpath:valueDate.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
<spring:bean id="staticDataLoader" name="staticDataLoader" class="StaticDalaLoader"
scope="singleton" init-method="initialize" />
<spring:bean id="valueDateService" name="valueDateService" class="ValueDateService">
<spring:property name="staticDataLoader" ref="staticDataLoader" />
</spring:bean>
</spring:beans>

<flow name="paymentHubServicesFlow1" doc:name="paymentHubServicesFlow1">
<inbound-endpoint exchange-pattern="request-response" responseTimeout="10000" address="${valueDate.host.url}"/>

<jersey:resources doc:name="REST">
<component doc:name="Value Date Service">
<spring-object bean="valueDateService"/>
</component>
</jersey:resources>
</flow>
</mule>

错误

********************************************************************************
Message : Failed to invoke JerseyResourcesComponent{paymentHubServicesFlow1.component.28420486}. Component that caused exception is: JerseyResourcesComponent{paymentHubServicesFlow1.component.28420486}. Message payload is of type: ContentLengthInputStream
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Sub type is invalid. (javax.activation.MimeTypeParseException)
javax.activation.MimeType:-1 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/activation/MimeTypeParseException.html)
2. javax.activation.MimeTypeParseException: Sub type is invalid. (org.mule.api.MuleRuntimeException)
org.mule.transformer.types.SimpleDataType:53 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MuleRuntimeException.html)
3. Failed to invoke JerseyResourcesComponent{paymentHubServicesFlow1.component.28420486}. Component that caused exception is: JerseyResourcesComponent{paymentHubServicesFlow1.component.28420486}. Message payload is of type: ContentLengthInputStream (org.mule.component.ComponentException)
org.mule.component.AbstractComponent:148 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/component/ComponentException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
javax.activation.MimeTypeParseException: Sub type is invalid.
at javax.activation.MimeType.parse(Unknown Source)
at javax.activation.MimeType.<init>(Unknown Source)
at org.mule.transformer.types.SimpleDataType.<init>(SimpleDataType.java:43)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
4

1 回答 1

1

如果您从 http:outbound 中删除 mimeType="text/xml"。它将停止错误。但是你会收到一个警告,说没有设置 Content-Type。如果您需要添加 Conent-Type,我会添加一个 set-property 来解决它。

<set-property propertyName="Content-Type" value="text/xml" doc:name="Property" />       

有一个 JIRA 已经为 contentType 打开了它的外观:http: //www.mulesoft.org/jira/browse/MULE-6487

但是对 Content-Type 有影响的 mimeType 很可能是另一个值得报告的错误。

于 2012-11-07T12:55:31.027 回答