我试图用改造发送POST请求到我的服务器。 我初始化我的服务是这样
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("http://myserver.com/api")
.build();
MyApi service = restAdapter.create(MyApi.class);
我创建了只保存整数和字符串像类:
class PostMessageBody {
private int someId;
private String someString;
//... and there is constructor with the fields and getters of them
}
而我的接口具有此方法发送POST
@POST("/my/server/path")
void myPostMethod(@Body PostMessageBody body, Callback<PostMessageBody> cb);
这是响应我得到的头
[: HTTP/1.1 400 Bad Request, Cache-Control: private, no-cache, no-store,
must-revalidate, max-age=0, Connection: close, Content-Length: 2211,
Content-Type: text/html, Date: Thu, 17 Apr 2014 07:58:20 GMT, Pragma: no-cache,
Server: LiteSpeed, X-Android-Received-Millis: 1397721501723,
X-Android-Response-Source: NETWORK 400, X-Android-Selected-Transport: http/1.1,
X-Android-Sent-Millis: 1397721501348]
我不知道我做错了。 有没有办法,我错过任何一部分?