Hi,
It's a bit hard to read in this way but it looks like the server returns a
list of users.
So you would need something like this:
Map responseMap = value.getResponseData();
List entries = (List)responseMap.get("data");
usr.getPropertyIndex().populateFromMap((Map)entries.get(0));
On Tuesday, June 1, 2021 at 6:49:12 AM UTC+3 [email protected] wrote:
> Hi,
>
> In debug the value value.getResponseData () is:
> [image: Muestra.png]
> I have "*usuario*" class that implements PropertyBusinessObject to
> receive interaction "0" (see image).
>
> When I try to receive the fields from the class they are in null (
> *usr.getPropertyIndex().populateFromMap(value.getResponseData())*; ).
>
> Thanks
>
> El Monday, May 31, 2021 a la(s) 8:45:59 PM UTC-5, Shai Almog escribió:
>
>> Hi,
>> It's hard to tell. Is the printout of data related to
>> value.getResponseData()?
>> What are the fields of User?
>> How does it fail? Is the user object not set?
>> If you step over it with a debugger is it set for a short while?
>>
>> On Monday, May 31, 2021 at 7:14:58 PM UTC+3 [email protected] wrote:
>>
>>> Hi,
>>>
>>> I am trying to consume a webservice using the restful API. It correctly
>>> returns the information I request:
>>>
>>> data => [{usuarioid=17, usuario=demo1, nombreempresa=Embutidora
>>> Nacional, impuesto=7, menuid=1, dispositivoid=4, leehuella=1, imei=55555,
>>> [email protected], nombre=Usuario Embutidos, radio=300,
>>> fuenteinventario=A, permitecambiarfoto=1, iniciosesion=1,
>>> contrasena=202cb962ac59075b964b07152d234b70, rangoinicio=100001,
>>> rangofin=150000, secuenciaorden=100054, estado=A,
>>> token=0a5b3d4a-5b8f-443d-af8e-cfb4100b71c4}]
>>>
>>> To consume I do the following:
>>>
>>> public static void login(Idioma idioma, String usuario, String
>>> contrasena, final SuccessCallback<Usuario> onSuccess, final
>>> FailureCallback<Object> onError) {
>>> Rest.get(SERVER_URL +
>>> "blank_ws_autenticar/blank_ws_autenticar.php").
>>> acceptJson().
>>> queryParam("contrasena", contrasena).
>>> queryParam("usuario", usuario).
>>> getAsJsonMapAsync(new Callback<Response<Map>>() {
>>>
>>> @Override
>>> public void onSucess(Response<Map> value) {
>>> usr = new Usuario();
>>> PreferencesObject.create(usr).bind();
>>> *
>>> usr.getPropertyIndex().populateFromMap(value.getResponseData())*;
>>> onSuccess.onSucess(usr);
>>> }
>>>
>>> @Override
>>> public void onError(Object sender, Throwable err,
>>> int errorCode, String errorMessage) {
>>> onError.onError(null, err, errorCode,
>>> errorMessage);
>>> }
>>> });
>>> }
>>>
>>> I cannot pass the information through the property "populateFromMap"
>>> What is the correct way to do it?
>>>
>>> Thanks
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/1bf6c65e-8468-40b6-a40a-d5d575c05080n%40googlegroups.com.