Pass the serializable JavaBean and operation name as the parameters. After invoking the API, you can get the synchronized result. Following is the sample code for invoking server side operation to query user's password by user name in the client side:
public static void main(String[] args) throws Exception { DataAdapter adapter = new MobileAdapter(); if (adapter.establishSession()) { User user = new User(); // set the user name as query condition user.setUserName("jack"); //query the user's password by invoking server side 'MobileQueryPasswordOp' operation User resultUser = (User) adapter.invoke("MobileQueryPasswordOp", user); //print the result System.out.println("the user password:::" + resultUser.getPassword()); } }
Following are the code samples for Data definition, Context definition, and Operation in the server side: