web-services - 如何在 Mule 中显示来自 Web 服务的错​​误而不是 Mule 的错误消息

标签 web-services mule esb mule-studio

例如,如果我发布了错误的帖子/直接将其放入网络服务,它将给我以下信息:

<prestashop>
   <errors>
      <error>
         <message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
      </error>
   </errors>
</prestashop>

但是,如果我通过 Mule ESB,该错误对我或其他开发人员根本没有帮助。

500 Internal Server Error
Unexpected character (R) at position 0.
Response code 404 mapped as failure. Message payload is of type: BufferInputStream

这是我在 Mule 中的流程

<http:request-config name="HTTP_Request_Configuration_PrestaShop4"  host="host.org/api/customers/#[message.inboundProperties.'http.query.string']" port="port" doc:name="HTTP Request Configuration" protocol="HTTPS">
    <http:basic-authentication username="keyU" password="keyP"/>
</http:request-config>

<flow name="prestaShopUpdateCustomerById">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" path="prestaShopUpdateCustomerById" doc:name="HTTP"/>
    <logger level="INFO" message="#[message.payloadAs(java.lang.String)]" doc:name="Logger"/>
    <http:request config-ref="HTTP_Request_Configuration_PrestaShop4" path="/" method="PUT" doc:name="HTTP">
        <http:request-builder>
        </http:request-builder>          
    </http:request>
</flow> 

是否可以让 Mule 显示 Web 服务的错​​误而不是此通用消息(此问题适用于 REST 和 SOAP Web 服务)。

谢谢

最佳答案

尝试添加一个涵盖所有情况的成功状态代码验证器(然后您可以更具体): <http:request path="path" method="method" config-ref="requestConfig"> <http:success-status-code-validator values="0..599"/> </http:request> 我希望这会有所帮助。

关于web-services - 如何在 Mule 中显示来自 Web 服务的错​​误而不是 Mule 的错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28697724/

相关文章:

java - WSO2 ESB 不会将多部分文件转发到代理服务

.net - 如何设计可由多个端点使用的 Web 服务 (microsoft)?

c# - 将大型阵列传输到客户端

Mule http 请求日志记录

web-services - 如何通过 WSO2 代理中的调用方法进行路由?

java - Mule 集合聚合器未返回正确的 List 序列

java - 在 JAXWS 服务器端检索 Soap header

java - 在 Java Web 应用程序(JAX RS,Jersey)中提交表单时将 ArrayList 传递到 Response 类方法

variables - 如何检查 Mule MEL 中是否存在 session 变量?

json - 如何在 Mule 中验证内容类型=JSON