Java android REST Api登录

Java android REST Api登录,java,android,json,ion,Java,Android,Json,Ion,我有一个端点,在SOAPI中如下所示: 我试着用android登录:我做到了: Ion.with(getApplicationContext()) .load("https://mobile.***.net.pl:447/***MobileProxy/proxy/sessions") .setBodyParameter("company", "TEST") .setBodyParameter("user", "pawelo") .

我有一个端点,在SOAPI中如下所示:

我试着用android登录:我做到了:

Ion.with(getApplicationContext())
        .load("https://mobile.***.net.pl:447/***MobileProxy/proxy/sessions")
        .setBodyParameter("company", "TEST")
        .setBodyParameter("user", "pawelo")
        .setBodyParameter("secure_password", "8ce241e1ed84937ee48322b170b9b18c")
        .setBodyParameter("secure_device_id", "8ce241e1ed84937ee48322b170b9b18c")
        .asString()
        .setCallback(new FutureCallback<String>() {


            @Override
            public void onCompleted(Exception e, String result) {

                Log.e("TAG " , result);
            }

        });
编辑:

JsonObject json1 = new JsonObject();
    json1.addProperty("company", "TEST");
    json1.addProperty("user", "pawelo");
    json1.addProperty("secure_password", "8ce241e1ed84937ee48322b170b9b18c");
    json1.addProperty("secure_device_id", "8ce241e1ed84937ee48322b170b9b18c");


Ion.with(getApplicationContext())
        .load("https://mobile.***.net.pl:447/SmokMobileProxy/proxy/sessions")
        .setJsonObjectBody(json1)
        .asString()
        .setCallback(new FutureCallback<String>() {


            @Override
            public void onCompleted(Exception e, String result) {

            }

        });

new RetrieveFeedTask().execute();
JsonObject json1=new JsonObject();
json1.addProperty(“公司”、“测试”);
json1.addProperty(“用户”、“pawelo”);
json1.addProperty(“安全_密码”,“8ce241e1ed84937ee48322b170b9b18c”);
json1.addProperty(“安全设备id”,“8ce241e1ed84937ee48322b170b9b18c”);
使用(getApplicationContext())
.加载(“https://mobile.***.net.pl:447/SmokMobileProxy/proxy/sessions)
.SetJSONObject主体(json1)
.asString()
.setCallback(新的FutureCallback(){
@凌驾
未完成公共void(异常e,字符串结果){
}
});
新建RetrieveFeedTask().execute();

您缺少的内容类型可能重复,并且您没有发布带有这些内容的JSONmethods@cricket_007我编辑了我的帖子,但现在我有了这样一个问题:但我不知道如何从服务器上读取回复。您是否尝试过使用
字符串结果
执行任何操作?在那里放置一些代码以处理来自服务器的响应:)
{
   "sctoken": "437973af-a372d319-9e57-492e-bdaf-2f5152d8624f",
   "tms":    [
            {
         "name": " MapCenterCache",
         "url": "http://cache2.***.net.pl/cache_2015/element?s=%zoom%&x=%x%&y=%y%"
      },
            {
         "name": "OSM Mapnik",
         "url": "http://tile.openstreetmap.org/%zoom%/%x%/%y%.png"
      },
            {
         "name": "OSM1",
         "url": "http://51.254.61.18:8104/tile/tilecache.cgi/1.0.0/osm_server_elte/%zoom%/%x%/%y%.png"
      },
            {
         "name": "Mapa",
         "url": "http://mapa.***.net.pl/tms/%zoom%/%x%/%y%.png"
      }
   ],
   "
JsonObject json1 = new JsonObject();
    json1.addProperty("company", "TEST");
    json1.addProperty("user", "pawelo");
    json1.addProperty("secure_password", "8ce241e1ed84937ee48322b170b9b18c");
    json1.addProperty("secure_device_id", "8ce241e1ed84937ee48322b170b9b18c");


Ion.with(getApplicationContext())
        .load("https://mobile.***.net.pl:447/SmokMobileProxy/proxy/sessions")
        .setJsonObjectBody(json1)
        .asString()
        .setCallback(new FutureCallback<String>() {


            @Override
            public void onCompleted(Exception e, String result) {

            }

        });

new RetrieveFeedTask().execute();