Exception handling 将原始异常返回到客户端,而不是返回CamelExecutionException Apache Camel

Exception handling 将原始异常返回到客户端,而不是返回CamelExecutionException Apache Camel,exception-handling,apache-camel,Exception Handling,Apache Camel,我在基于XML的spring上下文文件中定义了一个camel上下文。 有一个路由由SOAP(XML)web服务客户端bean调用。 在调用路由时,它抛出一些异常,客户端接收到驼峰异常,而不是原始异常 异常时对客户端的骆驼响应如下所示 我阅读了apachecamel文档中的exception子句主题,但是我找不到任何关于如何将原始异常返回到客户端的信息,sad!!有什么帮助吗 我尝试使用camel OneException,但没有成功:( java.lang.Exception 真的 发生错误

我在基于XML的spring上下文文件中定义了一个camel上下文。 有一个路由由SOAP(XML)web服务客户端bean调用。 在调用路由时,它抛出一些异常,客户端接收到驼峰异常,而不是原始异常

异常时对客户端的骆驼响应如下所示


我阅读了apachecamel文档中的exception子句主题,但是我找不到任何关于如何将原始异常返回到客户端的信息,sad!!有什么帮助吗

我尝试使用camel OneException,但没有成功:(


java.lang.Exception
真的
发生错误:${exception.message}

您可以打开
handleFault
让异常自动转换为SOAP故障。请参阅《动作2》第11章中的骆驼,其中有一个小示例:


或者您需要使用
而不是
来告诉Camel您正在将消息正文设置为SOAP错误。

谢谢Claus,我一个接一个地尝试了这两个选项,但都没有成功。谢谢Claus,很抱歉,因为我想先进行测试,所以添加我的注释迟到了。我尝试了这两个选项,一个接一个,但都没有成功。最初的项目是在blueprint中,在那里我用你的建议进行了测试,但结果是一样的,所以我想,这可能是因为blueprint依赖性。后来我用Camel将项目迁移到spring boot,并应用了你的建议,但还是没有成功。我想我可能遗漏了一些东西,因为我记得我使用了“handleFal”在过去的camelContext中,它是有效的。我正在使用camel2.19.0。有什么建议@Claus吗
  <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>Exception occurred during execution on the exchange: Exchange[ID-CZC4101XJV-53724-1497351782614-9-2]</faultstring>
  </soap:Fault>
  <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>blah blah blah Number Not valid, I am the original exception</faultstring>
  </soap:Fault>
    <route>
        <from uri="direct:remove" />
        <to uri="bean:removeBean?method=validationNubmer" />
        <to uri="bean:removeBean?method=checkBusiness" />
        <to uri="bean:removeBean?method=triggerRemove" />
    </route>
public void removeMe(String id) {
    RemoveRequest request = new RemoveRequest();
    request.setId(id);
    producer.requestBody("direct:remove", request);
}
    <onException>
        <exception>java.lang.Exception</exception>
        <redeliveryPolicy maximumRedeliveries="0" />
        <handled>
            <constant>true</constant>
        </handled>
        <transform>
            <simple>Error Occurred: ${exception.message}</simple>
        </transform>
    </onException>