例如,如果我发布了错误的帖子/直接将其放入网络服务,它将给我以下信息:
<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/