BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-02-2005, 03:58 AM   #1 (permalink)
New Member
 
Join Date: Aug 2005
Model: 6280
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Urget - Need help !!

Please Login to Remove!

Hi,

I am developing a application using JDE 4.0 for RIM device (6280). This application opens up a HTTP connection over network to exchange information between device and backend server application. I am facing problems while connecting to remote server from RIM device.

I don't have BES ! So I am relying on AT&T/Cingular's mMode and GPRS services on blackberry device to connect to a remote server over INTERNET.

The remote server application is on WEB and is accessible over INTERNET from a WEB BROWSER on a desktop machine.

When I run the application on BLACKBERRY SIMULATOR (JDE 4.0) environment within internal network as well as over internet it works fine. I can connect to the remote server from the Blackberry Simulator on desktop and run the application successfully.

But the application is not working when I deploy the same on RIM device and try to connect to remote server over INTERNET.

Blackberry device that we are using is upgraded and running on OS Version 4.0.

Here is the code that I am using to connect to remote server. The code sends a request to servlet on the server along with some parameters and the servlet fetches information from the backend database and passes back in response. This response is then used over blackberry device for further use in the application.

===code ========================================

StringBuffer sb = new StringBuffer();
HttpConnection connection = null;
InputStream is = null;

Settings setting = null;
User user = null;

try
{

//Get the Remote Server URL
setting = new Settings();
setting = SettingsDAO.getInstance().getSettings();
String strURL = setting.getSyncServer();

//Get User ID
user = new User();
user = UserDAO.getInstance().getUser();
String strUser = user.getUserId();

//Create the message to send to server
String message = GET_MSG + "," + strUser;

// open connection
connection = (HttpConnection)Connector.open(strURL);

// send message to server
OutputStream os = connection.openOutputStream();
os.write(message.getBytes());

if ((connection.getResponseCode() >= 200) && (connection.getResponseCode() < 300))
{

is = connection.openInputStream();

byte[] buffer = new byte[512];
int bytesRead = 0;
while (-1 != (bytesRead = is.read(buffer, 0, 512)))
{
sb.append(new String(buffer, 0, bytesRead));
}

}
else
{
throw new DAOException ("Server communication error: " + connection.getResponseCode() + " , " + connection.getResponseMessage());
}

// close connection.
os.close();
is.close();
connection.close();

return sb.toString();
}
catch (IOException e)
{
throw new DAOException("Unable to download data. Check if remote server is available.");
}
catch (Exception e)
{
throw new DAOException("Unable to download data. Check if remote server is available.");
}
finally
{
if (setting != null )
{
setting = null;
}

if (user != null )
{
user = null;
}
}
}

===code ========================================

Request help !!!
Offline  
Old 08-02-2005, 07:40 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Dec 2004
Location: in a house...
Model: lots
Carrier: Rogers
Posts: 1,148
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would first make sure the carrier will allow the data connection to go through.
I would then check that the firewall was allowing the traffic to go through.
I would then check that the server name is resolving from the internet.

It's going to be one of the above issues, and not an issue with your code.

cd.
Offline  
Old 08-02-2005, 08:39 PM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Aug 2004
Location: Metro NYC
Posts: 175
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

My educated guess is that strURL doesn't specify the correct WAP parameters for AT&T.
__________________
-- Aric Rosenbaum
BlackBerry consulting, BlackBerry development
www.arconsultinginc.com
BlackBerry consulting and development (RIM SI Partner)
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.