在使用SOAPUI测试REST控制器时,请求中的单个意外空值
我有一个控制器,该控制器通过SOAPUI接收请求对象(下面的屏幕)。让我感到困惑的是,此请求对象的两个属性中只有一个是null(不应该是),另一个是它的本质。
这是我的控制器:
@RestController
public class RestituzioneController {
private static final Logger logger = LoggerFactory.getLogger(RestituzioneController.class);
@Autowired
RestService restService;
@PostMapping(value="/restituzione")
public RestituzioneResponse restituzione(@RequestBody RestituzioneRequest request) {
logger.info("Start --------------- ");
logger.info("request {}",request.toString());
并且请求类是(我正在使用Lombok):
@Data
public class RestituzioneRequest {
private @NotEmpty String code;
private @NotEmpty String numP;
}
通过SOAPUI执行帖子呼叫(下面),这就是日志所述:
开始-------------------
请求RestituzionereQuest(代码= null, nump = 12xxx0000123)
I have a Controller which receives a request object via SoapUI (screen below). What confuses me it is that only one of the 2 attributes of this request object is null (it should not be), the other it is what it is meant to be.
This is my Controller:
@RestController
public class RestituzioneController {
private static final Logger logger = LoggerFactory.getLogger(RestituzioneController.class);
@Autowired
RestService restService;
@PostMapping(value="/restituzione")
public RestituzioneResponse restituzione(@RequestBody RestituzioneRequest request) {
logger.info("Start --------------- ");
logger.info("request {}",request.toString());
and Request class being (I'm using Lombok):
@Data
public class RestituzioneRequest {
private @NotEmpty String code;
private @NotEmpty String numP;
}
After executing a POST call through SoapUI (screen below) this is what the log states:
Start ---------------
request RestituzioneRequest(code=null,
numP=12XXX0000123)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试使用其他工具。 Postman
我很确定您的代码很好,这可能是SOAPUI版本问题的冲突。
Did you try with other tools eg. Postman
I'm pretty sure your code is perfectly fine, It might be conflict by SoapUI version issue.