Optimize Wireless Bandwidth Using Message Binding
Exercise
In this lab, you learn how to optimize your bottom-up application using the message binding wizard. By binding less data to the response message, the web service uses less wireless bandwidth.
Objectives
Discover how to optimize your bottom-up application using the message binding wizard.
See how the web service uses less wireless bandwidth.
Setup Tasks
Open 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 ,
Design the Main Screen and User Interface and
Create communication between the user interface and the length conversion web service for more details.
If you have not completed the first three labs in this series, create the LengthConverter project following these steps:
Download the LengthConverter workspace (ZIP) and unzip the file
Import the LengthConverter workspace to BlackBerry MDS Studio
Click File menu -> Import Existing… -> Browse - > select LengthConverter -> Finish
Tasks
Remove a field from the response message
In the Navigator pane, double-click the convertLengthResponse message.
Click the Fields tab.
Click the first Data Mapping cell.
Click ....
Clear the Is Mapped check box.
Click OK.
Change the data type that the response message uses
In the Type cell, click ....
Click decimal.
Click Next.
Click OK.
Assign the response message to the converted length value in the web service
In the Navigator pane, expand Messages.
Right-click convertLengthResponse.
Click Message Binding Wizard.
Click Next.
Click the convertLengthResponse output message.
Click Next.
In the list of BlackBerry MDS Application message fields in the left pane, click the convertLengthReturn: decimal field.
In the list of WSDL message fields in the right pane, click the toValue: double field.
Click Bind Field.
Click Finish.
Note: The length converter web service no longer incorporates the other WSDL message fields in the response message.
Change the global variable to match the response message data type
In the Navigator pane, expand Data > Globals.
Double-click result.
Click the drop-down arrow beside the Data Type field.
Click decimal.
Click OK.
Note: After changing the global variable data type, controls and messages previously mapped to it must be reassigned.
Assign the global variable to the edit box to display the converted length
In the Navigator pane, double-click scrMain.
Click the Result edit box.
In the Properties pane, in the Initial Value property, click ....
Expand Globals.
Click result: decimal.
Click Apply.
Click OK.
Assign the response message data to the result global variable
In the Navigator pane, double-click the convertLengthResponse message.
In the Message Editor, click the Fields tab.
In the Data Mapping cell, click ....
Select the Is Mapped check box.
Click the result global variable.
Click OK.
Remove the Result data component
In the Navigator pane, expand Definitions.
Right-click Result.
Click Delete.
Click Yes.
Click OK.
Save the project
In Navigator pane, click the LengthConverter project.
On the toolbar, click Save.
Additional Labs
Go to the first exercise in “Creating a Length Conversion Application Using the Top-down Approach”,
Create a Contact Using the Top-down Approach .
Back to the Developer Lab Main Menu