BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-04-2006, 10:27 PM   #1
bolocafe
New Member
 
Join Date: Sep 2006
Model: 8700
Posts: 5
Default http connection and MDS

Please Login to Remove!

Hi All,
I cannot download a file stored on web server. It is corporate blackberry. I can access web site using BlackBerry browser.

If I use simulator, it is working fine but when I use BlackBerry, I think it opens connection but it waits and nothing happens.
Here is code.

try {
StreamConnection s = (StreamConnection)Connector.open(_url + ";deviceside=false");
HttpConnection httpConn = (HttpConnection)s;
status = httpConn.getResponseCode();
}

It seems to me that it connects to MDS and waits and times out.

How do I trobleshoot problem? Do I need to check anything on MDS or BES?
I will appreciate any help. Prompt response will be appriciated.

Thanks
Offline  
Old 09-05-2006, 04:21 AM   #2
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

some example from one of my apps:

Code:
conn = (HttpConnection)Connector.open(URL);
conn.setRequestMethod(HttpConnection.GET);
in = conn.openInputStream(); 
byte[] data = new byte[800];
int numBytes = in.read(data);
(the 800 are set because we receive only a certain amount, you can/should make this flexible)

gs
simon
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 09-05-2006, 08:35 AM   #3
bolocafe
New Member
 
Join Date: Sep 2006
Model: 8700
Posts: 5
Default

Hi,
I tried what you suggested but I get same result.
Application is working on BlackBerry Simulator but it doesn't work on actual BlackBerry. After it opens connection, it waits and time out. It doesn't execute code to read stream. Anything related to network setup or configuration in MDS or BES?

Any help/suggestion?

Thanks
Offline  
Old 09-05-2006, 11:11 AM   #4
donricouga
Thumbs Must Hurt
 
Join Date: Jul 2006
Location: Atlanta
Model: 8703e
Carrier: Sprint
Posts: 58
Default

Make sure the Blackberry device is registered with BES.
Offline  
Old 09-06-2006, 02:43 PM   #5
eeksock
Knows Where the Search Button Is
 
Join Date: Sep 2005
Model: 8110
Carrier: Rogers
Posts: 15
Default

Quote:
Originally Posted by bolocafe
Hi All,
I cannot download a file stored on web server. It is corporate blackberry. I can access web site using BlackBerry browser.

If I use simulator, it is working fine but when I use BlackBerry, I think it opens connection but it waits and nothing happens.
Here is code.

try {
StreamConnection s = (StreamConnection)Connector.open(_url + ";deviceside=false");
HttpConnection httpConn = (HttpConnection)s;
status = httpConn.getResponseCode();
}

It seems to me that it connects to MDS and waits and times out.

How do I trobleshoot problem? Do I need to check anything on MDS or BES?
I will appreciate any help. Prompt response will be appriciated.

Thanks
If it works in your simulator, but not on your corporate BES/MDS, and your device is indeed registered with your corporate BES, then unfortunately (?) the best way to trouble shoot will involve talking to your BES team in your company, and getting them to turn on some additional MDS logging.

In the interim, try to surf to any corporate intranet site using the BlackBerry Browser on your device. If it works, that will at least confirm that MDS is working and the issue is specific to your program. If you can't surf intranet sites, then your device isn't configured or allowed to work with your corporate BES/MDS.


eeksock
Offline  
Old 09-06-2006, 03:31 PM   #6
bolocafe
New Member
 
Join Date: Sep 2006
Model: 8700
Posts: 5
Default

Hi,

Thanks for your input. I will ask BES team to look at log files

I can access intranet websites so MDS is running.

Actually, what I am trying to download xml file on BlackBerry. Is it possible that MDS/BES has filter that don't let it download xml file?

What is best way to download it?

I am using httpconnection.

Thanks
Offline  
Old 11-02-2006, 09:09 PM   #7
forcedfx
Knows Where the Search Button Is
 
Join Date: Nov 2006
Model: 8310
Carrier: AT&T (formerly Cingular)
Posts: 47
Default

If I'm not mistaken the problem is that your HTTP request is not within a separate thread.

I've read that the Blackberry will put up a user prompt (for security purposes) before your application is able to make an outgoing connection. However, the prompt does not appear because the application is waiting on the HTTP connection to complete. The two of them lock each other up in an endless wait.

It does work fine in the IDE though.

If anyone else reads this, can you enlighten me as to whether the prompt is shown for every HTTP connection that is made, or once per session? I want to develop a program that checks in on a server once every 5 seconds, but I'm up S's Creek if I'd be forced to allow the connection every time.
Offline  
Old 11-03-2006, 09:59 PM   #8
bolocafe
New Member
 
Join Date: Sep 2006
Model: 8700
Posts: 5
Default

Quote:
Originally Posted by forcedfx
If I'm not mistaken the problem is that your HTTP request is not within a separate thread.

I've read that the Blackberry will put up a user prompt (for security purposes) before your application is able to make an outgoing connection. However, the prompt does not appear because the application is waiting on the HTTP connection to complete. The two of them lock each other up in an endless wait.

It does work fine in the IDE though.

If anyone else reads this, can you enlighten me as to whether the prompt is shown for every HTTP connection that is made, or once per session? I want to develop a program that checks in on a server once every 5 seconds, but I'm up S's Creek if I'd be forced to allow the connection every time.
You are right. It was because I was not running under seperate thread.

About prompt, BB prompts once when your application attempts to make HTTP connection to server and remembers the setting. When you reopen same application, it will not prompt again.

However, if application attempts to create HTTP connection to another servers, it may prompt once for each server.
Offline  
Old 11-03-2006, 10:14 PM   #9
forcedfx
Knows Where the Search Button Is
 
Join Date: Nov 2006
Model: 8310
Carrier: AT&T (formerly Cingular)
Posts: 47
Default

Thanks, a single prompt when first connecting to a server is acceptable.
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Chroma 6312 DC Electronic Load Mainframe  picture

Chroma 6312 DC Electronic Load Mainframe

$239.96



Integrated Circuit IC Tester LCD Digital Display Multi-functional Integrated picture

Integrated Circuit IC Tester LCD Digital Display Multi-functional Integrated

$59.67



$99 Tektronix 7904 Oscilloscope Mainframe complete boards, switches, backplane picture

$99 Tektronix 7904 Oscilloscope Mainframe complete boards, switches, backplane

$99.00



Fluke Networks Versiv Modular Mainframe AS IS picture

Fluke Networks Versiv Modular Mainframe AS IS

$900.00



Used National Instruments SCXI-1000 Mainframe 1200 1120 1160(2) 181445D-01 U2 picture

Used National Instruments SCXI-1000 Mainframe 1200 1120 1160(2) 181445D-01 U2

$299.95



JDSU MAP-280 MAINFRAME picture

JDSU MAP-280 MAINFRAME

$3299.99







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