My problem is how to invoke a webservice method using connection request because in the
http://www.codenameone.com/how-do-i.html video you used JSON as the example.
here's my code:
public void Login(){
BoxLayout box = new BoxLayout(BoxLayout.Y_AXIS);
TableLayout tl = new TableLayout(2,2);
summary = new Form("Account Summary");
main = new Form("IBC Japan");
TextField userID = new TextField();
TextField password = new TextField();
Label user = new Label("User ID");
Label pass = new Label("Password");
Button loginbtn = new Button("Login");
Button exit = new Button("Exit");
loginbtn.setAlignment(Button.CENTER);
exit.setAlignment(Button.CENTER);
user.setAlignment(Label.RIGHT);
pass.setAlignment(Label.RIGHT);
Container fields = new Container();
fields.addComponent(user);
fields.addComponent(userID);
fields.addComponent(pass);
fields.addComponent(password);
fields.setLayout(tl);
main.setLayout(box);
main.addComponent(new Label(" "));
main.addComponent(new Label(" "));
main.addComponent(fields);
main.addComponent(loginbtn);
main.addComponent(exit);
//The red text is the example code from your tutorial which I followed.
ConnectionRequest r = new ConnectionRequest();
r.setPost(false);
r.addArgument("q", "@codename-one");
InfiniteProgress prog = new InfiniteProgress();
Dialog dlg = prog.showInifiniteBlocking();
r.setDisposeOnCompletion(dlg);
NetworkManager.getInstance().addToQueueAndWait(r);
loginbtn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt) {
//here in this section is where I want to add the connection request above but my problem is how should I do it here.
//I am new in codename one thats why I dont know how to add connection request as part of my code flow.
//I created the authenticateUser method using the web service wizard which accepts two string arguments and returns a boolean.
if(authenticateUser(userID,password)){
showSummary("acctBal");
}
else{
Dialog.show("Incorrect Input","The User ID and Password you entered are Incorrect","Retry",null);
}
}
});
exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}
});
main.show();