[英]Restful web-service Issue,GET method is working,but POST method is responding there is no resource for path
I have implemented a restful web-service in my Hybris 6.3(spring 4.3) using out-of-box extension. 我已经使用现成的扩展程序在Hybris 6.3(spring 4.3)中实现了一个宁静的Web服务。
The following is my controller code:- 以下是我的控制器代码:
@Controller
@RequestMapping(value = "/{baseSiteId}/dealer")
public class DealerController extends BaseController {
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public DealerData getCatalogs() {
DealerData dealerData = new DealerData();
//my code
...................
return dealerData;
}
@RequestMapping(method = RequestMethod.POST, consumes = "application/json")
@ResponseBody
public DealerData saveCatalogs(@RequestBody final DealerData dealerData) {
//my code
...................
return dealerData;
}
}
DealerData class:- DealerData类:-
private String uid;
private String firstName;
private String lastName;
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
I am able to access the get method through the GET request using Postman/ Advanced REST client - 我可以使用Postman / Advanced REST客户端通过GET请求访问get方法-
http://localhost:9001/testcommercewebservices/v2/test-site/dealer
http:// localhost:9001 / testcommercewebservices / v2 / test-site / dealer
but couldn't access POST method - 但无法访问POST方法-
http://localhost:9001/testcommercewebservices/v2/test-site/dealer
http:// localhost:9001 / testcommercewebservices / v2 / test-site / dealer
with body raw as JSON 主体原始为JSON
{
"uid": "123",
"firstName": "test",
"lastName": "test"
}
It looks like you are attempting to use POST
method on live deployment instead of test one 看起来您正在尝试在实时部署中使用
POST
方法,而不是测试一个
livecommercewebservices
vs testcommercewebservices
livecommercewebservices
与testcommercewebservices
and 和
test-site
vs live-site
test-site
与live-site
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.