1

Problem with JSON in java

Topic: Problem with JSON in java

I have a problem with a JSON format this is my code:

public void Datos(String id){
        long idLg = Long.parseLong(id);
        long flagLg = 8389633;
        JsonObject recibejson = new JsonObject();
        recibejson.addProperty("id", idLg);
        recibejson.addProperty("flags", flagLg);
        //recibejson = recibejson+"&sid=026cc36f88a8c46099a3ff3e48eace36";
        //System.out.println("JSON: " + recibejson + "&sid="+);
        //return recibejson.toString();
        RemoteHttpClient remoteHttpClient = RemoteHttpClient.getInstance();
        remoteHttpClient.remoteCall("core/search_item", recibejson, new ResponseHandler(){
            //url="core/search_item"+
            //remoteHttpClient.remoteCall(url, new ResponseHandler(){
            @Override
            public void onSuccess(String response)
            {
                System.out.println("Esto es lo que recibe");
            }
            @Override
            public void onFailure(int errorCode, Throwable throwableError) {
                super.onFailure(errorCode, throwableError);
                // search item failed, print error
                System.out.println(Errors.getErrorText(errorCode));
            }

        });

The problem is that as I can attach the "SID" so that I get back the answer according to this example:

"https://hst-api.wialon.com/wialon/ajax.html?svc=core/search_item&
    params={
        "id":34868,
        "flags":1025
    }&sid=<your_sid>;"

Suggest or coments please.

2

Problem with JSON in java

Re: Problem with JSON in java

You do not need to add the SID parameter, Java SDK will do it without any parameters. You can find an example of "searchItems" usage here.

Mobile Development
Gurtam
3

Problem with JSON in java

Re: Problem with JSON in java

Atention!!!!!!!!!!!!!!

wialon web services move to json ecma 404, You should check that standard, and see if your version of java is generating that same standard

4

Problem with JSON in java

(edited by Denisse 10/01/2017 18:48:38)

Re: Problem with JSON in java

kopa  Yes thank you for this information, because How can I get the values of the profile field of the unit, as well as its position and parameters of the unit ?, try to add the libraries but does not show me the information or not if it is coded.

Thank you for this information.

Some idea o suggest for this opinion.