我想在SOAP UI中查看以下方法的响应。url如下所示,用于调用SOAP UI中的accountDetails(..)方法来检查响应。
http://localhost:8080/AccountInfo/rest/account/0003942390
@RequestMapping(value = /accountDetails/{accNum}, method = RequestMethod.GET)
public void accountDetails(@PathVariable final String accNum)
{
final boolean accountValue = service.isAccountExists(accNum);
if (!accountValue )
{
throw new Exception();
}
}
该方法执行正确,但我在SOAP UI中得到的响应是404。accountDetails(..)方法返回类型为void,因此当我必须在SOAP UI中使用void返回类型检查方法的响应以显示成功消息时,我是否需要设置任何额外的参数。
以下是SOAP UI中显示的消息:
HTTP/1.1 404 /AccountInfo/WEB-INF/jsp/account/0003942390/accountInfo.jsp
Server: Apache-Coyote/1.1
是否引发异常?如果是,框架如何处理异常?
您的方法不返回任何内容-请参阅此处。基于URL的RESTful性质,该方法似乎应该返回类似AccountDetail的内容。然而,如果您真的只想看到200,那么只需返回一个非null字符串。