改造后返回错误的请求错误400(Retrofit POST return bad request e

2019-10-19 22:25发布

我试图用改造发送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]

我不知道我做错了。 有没有办法,我错过任何一部分?

文章来源: Retrofit POST return bad request error 400