我正在将SOAP服务迁移到REST。我要做的是有一个wsdl定义,并使用它来自动使用JAXB生成请求和响应类。
这是我的终点
@Endpoint
public class RefundServiceEndpoint {
@Autowired
private RefundService refundService;
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(value = RefundException.class)
public void handleException(RefundException exception) {
// This should be called
}
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(value = UnableToMapException.class)
public void handleException(UnableToMapException exception) {
// This should be called
}
@Autowired
HttpServletRequest serverRequest;
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "ReturnRequest")
@ResponsePayload
public ReturnResponse returnRequest(@RequestPayload ReturnRequest request) {
return this.refundService.partialRefund(request, serverRequest).getBody();
}
}
我抛出了这两个异常,但是未调用处理程序。 我设法获得它们的唯一方法是尝试/捕获,但我试图避免这种情况。
谢谢