私のサーバーに接続するために私のアプリケーションにサインインページとサインアウトページがあります。ログイン中にテキストボックスから値を取得し、サーバーにPOST要求を使用して送信します。Retrofit Error:500 Androidの内部サーバーエラー
public void LoginUser(View v)
{RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(ROOT_URL)
.build();
WashAPI api = adapter.create(WashAPI.class);
api.LoginUser(
Email.getText().toString(),
Password.getText().toString(),
//Creating an anonymous callback
new Callback<Response>() {
@Override
public void success(Response result, Response response) {
//On success we will read the server's output using bufferedreader
//Creating a bufferedreader object
BufferedReader reader = null;
//An string to store output from the server
String output = "";
try {
//Initializing buffered reader
reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
//Reading the output in the string
output = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
インタフェースは
public interface WashAPI {
@FormUrlEncoded
@POST("/xxx/yyy/signin")
public void LoginUser(
@Field("email") String email,
@Field("password") String password,
Callback<Response> callback);
}
をサインインするためにこれは、それがサインアウトの時には、私にトークンを返す私のサーバーAPIを使用してログインした後
良い作品私は、送信する必要があります私のセッションが体験されるようにトークン。
サインアウト
public interface SignoutAPI {
@FormUrlEncoded
@POST("/xxx/yyy/zzz/signout")
public void signout(
@Field("token") String token,
Callback<Response> callback);
}
マイコードがサインインし、SIGOUT
両方で同じであるが、サインインのためにそれが動作し、サインアウトするためのためのサインアウト
public void signout(View v)
{
Log.d("insidetoken",t);
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(ROOT_URL)
.build();
SignoutAPI api = adapter.create(SignoutAPI.class);
api.signout(t,
new Callback<Response>() {
@Override
public void success(Response result, Response response) {
BufferedReader reader = null;
String output = "";
try {
reader = new BufferedReader(new InputStreamReader(result.getBody().in()));
output = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
インタフェースのためのコードをそれは私にRETROFITエラーを与える:500内部サーバーエラー
問題は何ですか? –
サインアウト操作中に内部サーバーエラーが発生する理由 – livemaker
サーバにエラーがあります –