正在尝试调用服务 http:// IP:8080 / PQRS / LMN / XYZ / runTest / scheduledautomation / 1 / XYZ
JSON字符串以下
[ {"paramName":"TEST_TARGET_IDENTIFIER","paramValue":"ETest"},{"paramName":"TEST_SOURCE_ENTRY_IDENTIFIER","paramValue":"com.pack.etest"}]
@ResponseStatus(value = HttpStatus.NO_CONTENT) @RequestMapping(value = "/runTest/scheduledautomation/{runId}/{testEngine}", method = RequestMethod.POST) public void runScheduledAutomatedTest(@RequestParam String cronExpresssion, @RequestParam(required = false) @DateTimeFormat(iso = ISO.DATE_TIME) LocalDateTime endTime, @PathVariable Integer runId, @PathVariable TestEngine testEngine, @RequestBody List<TestEngineParam> testEngineParams) throws Exception { //Some Code }
响应:
必需的字符串参数'cronExpresssion'不存在
Required String parameter 'cronExpresssion' is not present
如何在邮递员客户端上调用混合的 @RequestParam 和 @RequestBody 服务?
how to invoke mixed @RequestParam and @RequestBody services on postman client ?
推荐答案我担心您想要的太多了:RequestParam,RequestBody以及作为REST查询的所有内容。这三件事中至少有两个是互斥的。
I fear you want a little bit too much: RequestParam, RequestBody AND the whole thing as a REST query. At least two of the three things are mutually exclusive.
我想您甚至可以通过将调用的URL修改为:
I think you could even get Postmaster to do this by modifying the called URL to:
http:// IP:8080 / PQRS / LMN / XYZ / runTest / scheduledautomation / 1 / XYZ?cronExpression =您的表达式
当然,这会破坏您的REST接口,但是正如我说:您的处理程序方法有点过于雄心勃勃 。
Of course this would ruin your REST interface, but as I said: your handler method is a little bit "over-ambitious".
更多推荐
使用邮递员客户端使用@RequestParam和@RequestBody调用服务
发布评论