如何从Java代码中捕获orbeon中的错误?
我有以下配置:如何从Java代码中捕获orbeon中的错误?,java,orbeon,Java,Orbeon,我有以下配置: <property as="xs:string" name="oxf.fr.detail.process.send-to-myservice.*.*"> set-data-status(status="safe") then send( uri="http://localhost:80/myservice",content="xml", replace="none") then success-message(message="Sav
<property as="xs:string" name="oxf.fr.detail.process.send-to-myservice.*.*">
set-data-status(status="safe")
then send( uri="http://localhost:80/myservice",content="xml", replace="none")
then success-message(message="Saved Successfully")
recover error-message(message="Save Failed")
</property>
即使myService引发异常,我也会成功保存消息
如何显示异常情况下的保存失败
。如注释中所述,您希望服务在发生错误时返回HTTP错误代码,而不是接受异常并返回字符串“fail”。我不熟悉您用来编写此服务的框架,但如果您让您的方法在发生错误时抛出异常,这种情况可能会立即发生。可能是重复的,您正在吞咽异常并返回一个正常字符串。。。调用方法如何知道存在问题?
@RequestMapping(value = "/myservice", method = {RequestMethod.POST},
produces = XML_CONTENT_TYPE)
@ResponseBody
public String myservice(HttpServletRequest request, HttpServletResponse response)
throws IOException {
try {
//Some logic
} catch (Exception e) {
return "fail";
}
return "success";
}