Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 41
Registered: ‎07-28-2010
My Device: Not Specified

Read HTML file - Request failed. Reason: Unexpected response code: 302

[ Edited ]

Hello everyone,

 

I've writing a BlackBerry app reading HTTP files from remote server.

If I type http://beginningblackberry.appspot.com/ in the text box, the app would connect to Internet and read HTML file of the address and produces the following output:

 

<html> 

<head><title>Form</title></head> 

<body><img src="img/apress_logo.png" /><br /> 

<form action="/" method="POST"><br /> 

<input type="text" name="content"></input> 

<input type="submit" value="Go!"/> 

</form> 

</body></html> 

 

 

it works fine with the simulator but when I install the app to a real device,

the app produces the error when it tries to read HTML file from remote server:

 

"Request failed.  Reason: Unexpected response code: 302" 

 

I've googled and found that this error is talking about redirection, but the link http://beginningblackberry.appspot.com/  is still accessible, it does not redirect user to any where else.

 

Please help me fix the problem!

 

Best regards,


Tuyen Nguyen

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Read HTML file - Request failed. Reason: Unexpected response code: 302

There could be a redirect from an intervening gateway.

 

I recommend that you review the header information that is returned with this request to see what it is telling you to do.

 

What connection method are you using with this request?

Contributor
Posts: 41
Registered: ‎07-28-2010
My Device: Not Specified

Re: Read HTML file - Request failed. Reason: Unexpected response code: 302

Hi Peter,

 

I use GET method, the respond header is Text/HTML

 

Thanks,

 

Tuyen Nguyen

Regular Contributor
Posts: 98
Registered: ‎08-31-2010
My Device: BB-9700
My Carrier: Airtel

Re: Read HTML file - Request failed. Reason: Unexpected response code: 302

Which connection medium you are trying to connect to your device like BES, BIS, WiFi or WAP ? Based on these connection medium, are you appending proper parameters at the end of URL?

Contributor
Posts: 41
Registered: ‎07-28-2010
My Device: Not Specified

Re: Read HTML file - Request failed. Reason: Unexpected response code: 302

I use WiFi to connect to server,

the postfix parameters are: ";deviceside=true;interface=wifi".

 

Best regards,

 

Tuyen Nguyen

Contributor
Posts: 41
Registered: ‎07-28-2010
My Device: Not Specified

Re: Read HTML file - Request failed. Reason: Unexpected response code: 302

I've just found this link

Connecting your BlackBerry - http and socket connections to the world

http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-c... 

and am reading it. Hopefully it will show me something, thanks all of you for your help.