BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-31-2007, 06:16 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: movistar
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default httpConnection

Please Login to Remove!

i building a httpconnection application but request this error message:

java.io.IOExeption: Open tunnel _ Failure

i have a biz service not a bes.

what is a problem in my appication?
Offline  
Old 07-31-2007, 08:35 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8800
PIN: N/A
Carrier: GPRS
Posts: 68
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you'd better open your cource and show us the error
Offline  
Old 08-01-2007, 11:18 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: movistar
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default mi source

package com.rim.samples.device.testConexion;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import net.rim.device.api.util.ObjectEnumerator;
import net.rim.device.api.collection.*;
import javax.microedition.lcdui.Spacer;
import net.rim.device.api.util.Arrays;
import java.lang.String;
import java.io.*;
import javax.microedition.io.HttpConnection;
import javax.microedition.io.*;
import javax.microedition.io.file.FileConnection;
import java.util.*;
import java.lang.Integer;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.i18n.Format;


public class Conntest extends UiApplication {

public static void main(String[] args){
Conntest conntest = new Conntest();
conntest.enterEventDispatcher();
}

public Conntest(){
pushScreen(new IformScreen());
}

final class IformScreen extends MainScreen
{
////////////////////
public String tipoConeccion = "page";
public String sServidor = "ip_server";
////////////////////

public AutoTextEditField txtMensaje;

public IformScreen()
{
setTitle(new LabelField("Test Conexion", LabelField.FIELD_HCENTER));
String cadena = sConexion("SELECT * FROM TABLE");
txtMensaje = new AutoTextEditField("MENSAJE : ","");
txtMensaje.setText(">>> "+cadena);
add(txtMensaje);
}


public String sConexion(String sQuery){
HttpConnection httpConnector = null;
InputStream in = null;
StringBuffer inBuffer = new StringBuffer();
String cadenaResponse ="";
byte[] bufferLectura;
int inChar;
String URL = "http://"+sServidor+"/"+tipoConeccion+".asp?Q="+ sQuery;

try {
httpConnector = (HttpConnection)Connector.open(replace(URL," ","%20"));
httpConnector.setRequestMethod(HttpConnection.GET) ;
httpConnector.setRequestProperty("Content-Type","text/plain");
in = httpConnector.openInputStream();
long longitudDatos = httpConnector.getLength();
bufferLectura = new byte[(int)longitudDatos] ;
in.read(bufferLectura);
cadenaResponse = new String(bufferLectura);
}catch(IOException ioe){
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> ERROR : "+ioe);
cadenaResponse = "" + ioe;
}
return cadenaResponse;
}

public String replace(final String aInput,
final String aOldPattern,
final String aNewPattern)
{

final StringBuffer result = new StringBuffer();
int startIdx = 0;
int idxOld = 0;
while ((idxOld = aInput.indexOf(aOldPattern, startIdx)) >= 0) {
result.append(aInput.substring(startIdx, idxOld));
result.append(aNewPattern);
startIdx = idxOld + aOldPattern.length();
}
result.append(aInput.substring(startIdx));
return result.toString();
}


}

}
Offline  
Old 08-06-2007, 01:18 AM   #4 (permalink)
Thumbs Must Hurt
 
Rose's Avatar
 
Join Date: Nov 2006
Location: India
Model: 9700
OS: Windows 7
Carrier: Airtel
Posts: 121
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
The open Tunnel failure exception occurs mainly due to the lack of apn settings. In options - > advanced options -> tcp/Ip settings check whether you have proper values in all the fields relavent to your carrier.
If so you wont be getting the TunnelFailure Exception.
Offline  
Old 08-06-2007, 03:57 PM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8100
PIN: N/A
Carrier: movistar
Posts: 51
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Apn

Hi, thanks
in my apn say "internet.com" but user and password apn is blank.
but whit the explorer i can navigate to internet and see the page .asp in my httpconnection class call.
Offline  
Old 08-13-2007, 04:52 PM   #6 (permalink)
New Member
 
Join Date: Aug 2007
Model: 8100
PIN: N/A
Carrier: T-Mobile
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for this post!!!! This was hanging me up for days!

This link may help WebMessenger Inc. APN settings

It lists most providers and apn settings.
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.