MOBILE

The Connected BlackBerry : Connection Paths (part 1) - Wireless Application Protocol Connection, Direct TCP Internet Connection, BlackBerry Internet Service Connection

10/19/2012 9:33:28 PM
A BlackBerry smartphone application has multiple paths that it can use to access data located outside of the device (most likely on a server somewhere). A path is the route the request (and corresponding response) takes to get from the device to the server and back. The BlackBerry browser  and BlackBerry Java applications can access servers using any of the paths. The options are
  • Wireless Application Protocol (WAP)

  • Direct TCP

  • BlackBerry Internet Service (BIS)

  • BlackBerry Mobile Data System (MDS)

  • Wi-Fi

A good understanding of connections is important because application developers often need to decide which path to use to get to their data and write the code that the connection needs to use that path. When a developer doesn’t understand all the available options, the option selected might not be the best one for the application or the mobile user, and the application might not work if the wrong connection path is used. When building applications, RIM recommends a different prioritization of transports, depending on the intended audience for the application. Applications should try the first transport and move down the list until a connection can be made.

For Enterprise applications, RIM recommends the following prioritization:

  1. BlackBerry Mobile Data System (MDS)

  2. Wi-Fi

  3. Wireless Application Protocol (WAP) 2.0

  4. BlackBerry Internet Service (BIS)

  5. Direct TCP

  6. WAP 1.0/1.1

For consumer applications, RIM recommends the following prioritization:

  1. Wi-Fi

  2. Wireless Application Protocol (WAP) 2.0

  3. BlackBerry Internet Service (BIS)

  4. BlackBerry Mobile Data System (MDS)

  5. Direct TCP

  6. WAP 1.0/1.1

The following sections cover the various connection paths and highlight the strengths and limitations of each.

1. Wireless Application Protocol (WAP) Connection

Before smartphones, back in the days of the early feature phones, carriers wanted to provide their customers with access to Internet-based resources. Because of the limitations of these devices (processing power, browser capabilities, and network bandwidth) a special protocol was created to provide a subset of typical desktop web-browsing capabilities to mobile devices. This protocol, WAP, required special gateways provided by the wireless carriers and used a special, reduced capability mobile page markup language called Wireless Markup Language (WML).

WAP used to be the most consistent way to access the Internet from mobile phones—both smartphones and regular mobile phones supported the protocol. Today, WAP gateways are still provided by carriers and there are a lot of services still offered via WAP.

When you open a WAP connection, either through a URL opened in the WAP browser or through a connection from a Java application, the request takes a special route through the WAP gateway provided by your wireless carrier. As shown in Figure 1, a WAP request travels from the BlackBerry device (1) to the carrier’s WAP gateway (2), and then out to the public Internet (3). The response from the server follows the same path only in reverse order. The WAP gateway acts as a proxy for the requests made by the device and can reformat the data (convert HTML to WML, for example) returned to the requesting application.

Figure 1. WAP request path

When connecting via WAP from a Java application, the way it’s done varies depending on which version of WAP you use. With WAP 2.0, your application must append the unique ID (UID) of the WAP 2.0 Service Book to the Connector.open command. To implement this, your application must first locate the WAP 2.0 Service Book, then retrieve the UID for the Service Book  and include it as a parameter in the call to Connector.open:

HttpConnection conn = (HttpConnection)Connector.open(
"http://somewapsite.com;ConnectionUID=WAP2 trans");

You can’t just assume the name of the UID; you must look up the WAP 2.0 Service Book on every device your application runs on, unless your application is only targeted to a single carrier’s customers and you are comfortable hard-coding it in your application. Although it might look like you can make an assumption about the UID for the Service Book, it is possible that the carrier will use a different value in the Service Book it pushes to a device. Additionally, Service Book settings can change at any time and be pushed to the device, so it is risky to hard-code the Service Book information.

Note

On the BlackBerry, the implementation of WAP 2.0 is just a Service Book-based TCP connection.


If your application is using a WAP 1.0 or WAP 1.1 connection, you must append the Access Point Name[2] (APN) provided by the carrier for the WAP connection. In the following sample Java code, both WAPGatewayAPN and WAPGatewayIP are required parameters for the call to Connector.open:

[2] An Access Point Name describes the gateway server that the device uses for its connection.

HttpConnection conn = (HttpConnection)Connector.open(
"http://somewapsite.com;WapGatewayIP=0.0.0.0;WapGatewayAPN=
apn_name");

As with the WAP 2.0 connection, to use the WAP 1.0/1.1 connection provided by the carrier, you need to locate the Service Book for the connection and retrieve the values for WAPGatewayAPN and WAPGatewayIP to use in your application.

2. Direct TCP Internet Connection

Another way to access the Internet from either a browser or Java application is to use an Internet connection using Transmission Control Protocol (TCP), called Direct TCP. The Direct TCP request takes a route from the BlackBerry device (1) through an Internet gateway provided by the carrier (2) to the server processing the request (3), as shown in Figure 2. The path is similar to the one shown in Figure 1, except that the request is delivered through an Internet gateway located at the carrier data center rather than a WAP gateway. The Internet gateway does not perform any reformatting of the data as it is returned to the application requesting the data.

Figure 2. Direct TCP Internet request path

When opening a connection using Direct TCP, the application must use the APN for the particular device’s current wireless carrier. The easiest way to do this is to direct the BlackBerry to select the APN automatically as shown in the following Java code:

HttpConnection conn = (HttpConnection)Connector.open(
"http://www.somesite.com;deviceside=true");

In this example, the deviceside=true parameter tells the device to manage the connection rather than directing it through MDS (described next) or through a specific APN (either provided by the user or the carrier). In many cases, the device will not be provisioned by the carrier with the information the device needs to determine the APN, and the connection will fail.

You can specify the specific APN to use for the connection, as follows:

HttpConnection conn = (HttpConnection)Connector.open(
"http://www.somesite.com;deviceside=true;apn=apn_name");

This might be problematic because you need the user to provide the name of the carrier’s APN or you have to build logic into your application to know the APNs for every carrier network you support with your application.

Some APNs require that credentials are provided when the connection is made. The credentials are appended to the URL string passed to Connector.open, as shown here:

HttpConnection conn = (HttpConnection)Connector.open(
"http://www.blackberry.com;deviceside=true;
apn=wap.cingular; TunnelAuthUsername=some_username;
TunellAuthPassword=some_password");

3. BlackBerry Internet Service Connection

The BlackBerry Internet Service (BIS) is a special service that BlackBerry users can subscribe to from their carriers to provide Internet access to BlackBerry smartphones. In most cases, enterprise-activated BlackBerry devices already have this capability (BIS is included with most, if not all, BES plans), but consumers purchasing BlackBerry devices must be provisioned for BIS to be able to access their mail (up to ten personal mail accounts) on the device, browse the Internet, and run Internet-enabled applications.

One of the issues with Direct TCP connections to Internet-based servers is that an application might not be sure whether the connection parameters have been set or set correctly or, if not set, what they might be. RIM created a special connection type called BlackBerry Internet Service – Browser (BIS-B), which eliminates the carrier dependencies inherent in making connections.

BIS-B routes the request from the BlackBerry smartphone (1) through the carrier’s network (2) to the BlackBerry infrastructure (3) to the destination server (4), as shown in Figure 3. It eliminates any requirement for the device to understand anything about the carrier’s connection to the Internet. Unfortunately, today, this option is only available to ISV Alliance Partners, but RIM has stated that it might open this to other developers in the future.

Figure 3. BIS-B request path

When using this connection type, be careful how much data you send across it. Because the connection goes through the BlackBerry infrastructure, it is possible that RIM will restrict how much data you send through this connection. Contact RIM for information about how to become a member of the ISV Alliance Program.

Other  
 
Video
Top 10
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
The latest Audi TT : New angles for TT
Era of million-dollar luxury cars
Game Review : Hearthstone - Blackrock Mountain
Game Review : Battlefield Hardline
Google Chromecast
Keyboards for Apple iPad Air 2 (part 3) - Logitech Ultrathin Keyboard Cover for iPad Air 2
Keyboards for Apple iPad Air 2 (part 2) - Zagg Slim Book for iPad Air 2
Keyboards for Apple iPad Air 2 (part 1) - Belkin Qode Ultimate Pro Keyboard Case for iPad Air 2
Michael Kors Designs Stylish Tech Products for Women
REVIEW
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
Popular Tags
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Exchange Server Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe Photoshop CorelDRAW X5 CorelDraw 10 windows Phone 7 windows Phone 8 Iphone