BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 08-07-2008, 09:55 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2008
Model: 8310
PIN: N/A
Carrier: Informatico
Posts: 56
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with httpconnection

Please Login to Remove!

Hi, I have this code to read a webservice:

String url = Globales.CadenaConexion + "service.asmx/ObtenerInformaticaEmailsXML";
//url = url + "?operario=" + operario_actual;
http = (HttpConnection)Connector.open(url);
http.setRequestMethod(HttpConnection.POST);
http.setRequestProperty("Content-Language","es-ES");
//http.setRequestProperty("Content-Type","text/xml; charset=utf-8");
http.setRequestProperty("Content-Type","application/x-www-form-urlencoded");

os = http.openOutputStream();
//params = "operario=" + operario_pub;
//os.write(params.getBytes());
os.flush();

int respuesta_servidor = http.getResponseCode();
if (respuesta_servidor==200) {
............
......


the problem is that the variable respuesta_servidor = 500 and if I execute manually in the internet explorer using the button invoke the webservice ObtenerInformaticaEmailsXML and goes correctly, the url is correct too. What can be the problem?

Thanks, Oscar
Offline  
Old 08-08-2008, 07:46 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi!

So I'd like more information (remember, more is always better!).

- What is "Globales.CadenaConexion" ? Presumably, that's the beginning of the URL, but there are some interesting things that even that string can indicate, so it's better to show us exactly what it contains (for instance, if it looks like "http://this.is.my.http.server", the final URL will look like "http://this.is.my.http.serverservice.asmx/ObtenerInformaticaEmailsXML", which is probably not what you're hoping for).

- Does this code fail on a BlackBerry simulator? The simulator will not connect to the Internet unless the MDS simulator is also running on the same machine. In addition, the MDS simulator must have the same proxy/firewall settings as IE. If you launch the MDS simulator, and then launch the BlackBerry Simulator, then try to use the BlackBerry browser to go to some website such as google.com, you should see the results on the BlackBerry simulator, which indicates that the MDS simulator is set up correctly.

- Does this code fail on a real BlackBerry device? The device must be fully activated with the service provider and capable of accessing the Internet (say, through the browser).

Check the following regarding HTTP response codes:

List of HTTP status codes - Wikipedia, the free encyclopedia

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
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

Chair Arm Pad Memory Foam Soft Office Cushion Chair Armrest Covers Set of 2
$20.66
Chair Arm Pad Memory Foam Soft Office Cushion Chair Armrest Covers Set of 2 pictureUSA Patriotic Hard Hat “Hard Hat For Americans” Sept 11, 2001 Memorial Edition
$25.0
USA Patriotic Hard Hat “Hard Hat For Americans” Sept 11, 2001 Memorial Edition pictureNew Old Stock Allen Bradley MicroLogix 1762-MM1 Memory Module
$25.0
New Old Stock Allen Bradley MicroLogix 1762-MM1 Memory Module pictureNew Sealed 6ES7952-1AM00-0AA0 Siemens Simatic S7-400 Memory 4MB Get it now
$973.0
New Sealed 6ES7952-1AM00-0AA0 Siemens Simatic S7-400 Memory 4MB Get it now  pictureAllen Bradley 905472-01 EN06 32745 BUBBLE MEMORY
$65.0
Allen Bradley 905472-01 EN06 32745 BUBBLE MEMORY picture






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