Runtime components : Channels components : Mobile Channel : Tasks : Invoking server operation : Invoking session operation using the basic way
  
Invoking session operation using the basic way
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:
1 Data definition:
Screen capture of data definition
2 Context definition:
Screen capture of context definition
3 Operation:
Screen capture of operation
Go up to
Invoking server operation