我已经转换为字节数组,但我经常遇到这个错误:
ERROR 2015-02-25 11:12:30,517 [[ESR].HTTP_Request_Listener.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Response code 400 mapped as failure. Message payload is of type: BufferInputStream
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Response code 400 mapped as failure. Message payload is of type: BufferInputStream (org.mule.module.http.internal.request.ResponseValidatorException)
org.mule.module.http.internal.request.SuccessStatusCodeValidator:37 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/http/internal/request/ResponseValidatorException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as failure. Message payload is of type: BufferInputStream
at org.mule.module.http.internal.request.SuccessStatusCodeValidator.validate(SuccessStatusCodeValidator.java:37)
at org.mule.module.http.internal.request.DefaultHttpRequester.innerProcess(DefaultHttpRequester.java:202)
at org.mule.module.http.internal.request.DefaultHttpRequester.process(DefaultHttpRequester.java:166)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
这是我的流程:
<sub-flow name="requestBeanCreate">
<object-to-byte-array-transformer />
<set-payload value="#[app.registry.messageBean.createServiceRequest(message.inboundProperties['http.uri.params']['name'],payload)]"/>
</sub-flow>
<flow name = "RequestsEntryFlow" >
<http:listener allowedMethods="POST" parseRequest="false" config-ref="HTTP_Request_Listener" path="/{name}" doc:name="HTTP Entry Flow" />
<flow-ref name="requestBeanCreate" />
<choice doc:name="Choice">
<when expression="#[app.registry.messageBean.isEMCRequired(payload)]">
<jms:outbound-endpoint connector-ref="jms-connector" ref="EMCRequiredRequestsQueue" />
</when>
<otherwise>
<flow-ref name="req" />
</otherwise>
</choice>
</flow>
<http:request-config parseResponse="false" name="HTTP_Request_Configuration" />
<sub-flow name = "req">
<set-variable variableName="id" value="#[payload]" doc:name="Variable" />
<set-variable variableName="destination" value="#[app.registry.routerBean.getDestination(app.registry.messageBean.getReceiverID(payload))]" doc:name="Variable" />
<set-payload value="#[app.registry.messageBean.sendRequestToDestination(payload)]" />
<processor-chain>
<http:request parseResponse="false" config-ref="HTTP_Request_Configuration" host="#[flowVars.destination]" port="80" path="/" method="POST" />
<object-to-byte-array-transformer />
<expression-component>
app.registry.messageBean.sendResponseToSender(flowVars.id);
app.registry.messageBean.messageProcessedSuccessfully(flowVars.id);
</expression-component>
</processor-chain>
</sub-flow>
答案 0 :(得分:7)
您似乎从HTTP请求中获取了400状态代码,该代码在到达变换器之前导致异常。尝试添加一个涵盖所有案例的成功状态代码验证器(您可以选择稍后考虑哪些案例):
<http:request parseResponse="false" config-ref="HTTP_Request_Configuration" host="#[flowVars.destination]" port="80" path="/" method="POST">
<http:success-status-code-validator values="0..599"/>
</http:request>
答案 1 :(得分:0)
在使用twitter mulesoft适配器发布状态更新时,我也遇到了此错误,但是在使用了一些谷歌搜索&amp;试用,我发现错误不在于适配器,而是将有效负载字符串传递给适配器。
在SetPayload中,在值字段中尝试此表达式:#['RT @'+ message.payload [0] .user.screenName +':'+ message.payload [0] .text]
在twitter适配器中尝试以下值:
操作:更新状态 状态:#[payload]
如果仍然出现错误,“message.payload [0] .text”中可能会有一些特殊字符,这是screenName的最后一条推文,要么尝试放置没有更新状态适配器的记录器,要检查是否你可以正确记录它。
答案 2 :(得分:-1)
感谢Madajee。我有同样的问题,你的回答帮我解决了。此外,除此之外,Twitter访问存在一些问题,必须结合使用才能确保您拥有可行的解决方案。特别是围绕更改DT(Direct Tweet)的权限并重新生成Access Key并在Twitter连接器配置中重新输入它。