Tuesday, 15 July 2014

java - Data from RPC call from client-service to caller (GWT) -



java - Data from RPC call from client-service to caller (GWT) -

i can't explain next situation:

i create rpc phone call load info server files in list of serializable objects.

the problem following:

the phone call executed fine far can tell (that's why didn't post interfaces , serverside code). when set list on clientside fine (i check size in setdata()). when want assign list object in class calling empty list (sizecheck returns nullpointer).

here clientside code:

public class dataimportserviceclientimpl { private dataimportserviceasync service; private list<datarow> data; public dataimportserviceclientimpl(string url){ this.service = gwt.create(dataimportservice.class); servicedeftarget endpoint = (servicedeftarget) this.service; endpoint.setserviceentrypoint(url); } public void readinput(string auswertung){ this.service.readinput(auswertung, new defaultcallback()); } public list<datarow> getdata() { homecoming data; } public void setdata(list<datarow> data) { this.data = data; system.out.println(data.size()); //returns right value } private class defaultcallback implements asynccallback { @override public void onfailure(throwable caught) { system.out.println("an error has occured!"); } @override public void onsuccess(object result) { if(result instanceof list<?>){ list<datarow> temp = (list<datarow>) result; setdata(temp); } } } }

i phone call here (this different class):

private dataimportserviceclientimpl importer = new dataimportserviceclientimpl(gwt.getmodulebaseurl()+"dataimport"); private string auswertung = "xyz"; private list<datarow> info = new arraylist<datarow>(); public void onmoduleload() { importer.readinput(auswertung); info = importer.getdata(); system.out.println(importer.getdata().size()); //returns nullpointer = same data.size()

java gwt rpc

No comments:

Post a Comment