|
|
|
|
|
|
|
|
Create Communication Between the User Interface and the Length Conversion Web ServiceExerciseCreate the communication between the user interface and the length conversion web service. To transmit the data to the web service, create a screen local variable and map data to it for storage. Data selected from or entered in the drop-down lists and text box can be mapped to this local variable before being sent as a message to the web service. A request message bound to the web service and containing the data from the local variable enables the conversion web service. Objectives
Setup TasksOpen BlackBerry MDS Studio™ and select the LengthConverter project which you created in the previous labs. See the labs entitled Creating a Bottom-up BlackBerry MDS Studio Project and Design the Main Screen and User Interface for more details. If you have not completed the first two labs in this series, create the LengthConverter project following these steps:
TasksCreate a local variable
Assign controls to the lengthParameters local variable
Set the Convert button to send data to the web service for conversionUsing the button, the user can activate the web service. When pressed, the BlackBerry MDS Application sends the data on the main screen to the lengthParameters local variable. The convertLengthRequest message sends the local variable information to the web service. The conversion web service converts the length value.
Tip: You can view the script that the BlackBerry MDS Studio generates in Navigator > Scripts. Double-click script_Onscr_Mainbutton1Click. The script displays the syntax for sending a message to the web service when the user clicks the Convert button. Create a global variable to receive data from the web serviceWhen the web service converts the length, it generates a response message containing the converted length data. The LengthConverter application stores this data in a global variable. To display the converted length to the user you map the Result edit box to the global variable.
Map the web service response message to the result global variable
Note: The convertLengthResponse message and the result global variable are related. When the web service sends a response, the LengthConverter application stores the value in the result global variable. The relationship canvas displays the visual representation between the message and data. Map the result global variable to the edit box to display the converted length
Refresh the main screen when receiving the response messageThe LengthConverter application receives the converted length in the web service response message. To display the converted length, the main screen must refresh when the application receives the response message.
Save the project
Additional LabsGo to the next exercise in “Creating a Length Conversion Application Using the Bottom-up Approach”, Optimize Wireless Bandwidth Using Message Binding . |
|
|||||||||
|
|
|
|
|
|
| Home |
Products |
Solutions |
Purchasing |
Support |
Developers |
Worldwide |
News |
About Us |
Contact Us |
Site Map Legal | Copyright © 2008 Research In Motion Limited, unless otherwise noted. |