End-to-end functionality in Mobility Pack (10 Minutes)


This demo showcases the end-to-end functionality available in Mobility Pack.

Product Versions Supported

6.0 Beta1+

Points to Hit

  • NetBeans is an end-to-end tool.
  • Easy to talk with Java EE server over web services if mobile phone supports JSR 172.
  • We also have a solution if JSR 172 is not supported on the phone (as shown in the slides).

Demo Prep


We're at Beta, anything can go wrong.


  • Drag and drop the Login Screen from palette.
  • Wire the LoginCommand from main form with the Login Screen.
  • Drag and drop the Wait Screen.
  • Wire the Login Screen with the Wait Screen.
  • Wire the Success Command from the Wait Screen with Alert1.
  • Change the exit wire from Alert1 so that it goes back to the Login Screen (so that the user can go back).
  • Double click on Alert1 and change it's text to "Login Successful".
  • Wire the Failure Command from the Wait Screen with Alert2.
  • Change the exit wire from Alert2 so that it goes back to the Login Screen (so that the user can go back).
  • Double click on Alert2 and change it's text to "Login Failure".
  • You should have now following flow design.
  • Say that we will now develop the backend part - the web service that is going to perform authentication.
  • Close all the screens.
  • Create a new Web Application called WSAuth.
  • Close index.jsp.
  • Create a new web service. Call it WSAuth. Explain the visual designer and switch to the editor.
  • Create a new operation called auth, return type boolean, two parameters: String username, String password.
  • Write following code:
  return username.equals("demo") && password.equals("demo");
  • Deploy the web service.
  • Test the web service and explain the tester. Try both positive and negative test.
  • Show the WSDL file by changing the Tester URL to WSDL.
  • Switch back to Mobile project.
  • Show the login screen component.
  • Back to flow and select the Wait Screen.
  • Go to it's properties and choose Task.
  • In the task choose Go to source.
  • Explain the source. Mention that now we need to create a new web service client. In this demo we assume that the mobile supports JSR 172, if it would not we could use the web services proxy.
  • Take the WSDL URL either from the web service properties or from the WSDL document you opened in the web browser.
  • Create a new Java ME web service client and use the WSDL URL, retrieve it from the server. Finish the wizard. Client stubs are generated.
  • Go to the task code and write the following code:
                    WSAuthService ws = new WSAuthService_Stub();
                    boolean logged = ws.auth(getLoginScreen().getUsername(), getLoginScreen().getPassword());
                    if (!logged) throw new Exception();
  • We're ready to run the application. Show the login functionality with both correct and incorrect credentials. Don't forget you need to press the middle button to type text into the username and password fields. Explain again what is going on on background.

Demo Cleanup

Delete the demo project.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo