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
Developer
kumaresan
Posts: 183
Registered: ‎12-17-2008
My Device: 8320

Webservice Call - Java.io.IOException : tunnel timed out.

Hi All,

 

I used voice recorder in my application. after capturing the voice i send the

 

byte array to my webservice. For webservice call, i have used ksoap2-j2me-core-2.1.2.jar.

 

Problem is : When check with log from server, my call could hit the server, and response was

 

success. But from device side , i got Java.io.IOException :Tunnel timed out exception.

 

How to solve this problem?

 

Thanks in advance,

 

kums

******************************

Press kudos which the post help you
Please mark posts as solved if you got a solution
Developer
kumaresan
Posts: 183
Registered: ‎12-17-2008
My Device: 8320

Re: Webservice Call - Java.io.IOException : tunnel timed out.

Can anybody help me.

 

I tried to call .net webservice . 

kums

******************************

Press kudos which the post help you
Please mark posts as solved if you got a solution
Developer
sonicboomboy
Posts: 466
Registered: ‎03-04-2009
My Device: 8520

Re: Webservice Call - Java.io.IOException : tunnel timed out.

What connection method are you using to connect to the internet? Did you try to run your code in debug mode and inspect where the exception is being thrown?

Got resolved! Press kudo icon!
Developer
kumaresan
Posts: 183
Registered: ‎12-17-2008
My Device: 8320

Re: Webservice Call - Java.io.IOException : tunnel timed out.

Thanks for your reply.

 

I tested with this in blackberry bold 9000 simulator. 

 

In debug mode i tested already, If control comes to httpTransport.call() it throws

 

tunnel time out exception.

 

for your reference i gave some code snippet here.

 

String result = null;       
        String serviceUrl = URI + ";deviceside=true";
        String serviceNamespace = "http://tempuri.org/";
        String soapAction = "http://tempuri.org/getData";        
        SoapObject rpc = new SoapObject(serviceNamespace, "getData");
        byte[] raw = "value"; --- > voice recorder byte[]
        rpc.addProperty("f",new String(raw));//new String(rawData)
                  
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
           
        envelope.bodyOut = rpc;
        envelope.dotNet = true;
        envelope.encodingStyle = SoapSerializationEnvelope.XSD;
           
        if(WLANInfo.getWLANState() == WLANInfo.WLAN_STATE_CONNECTED)
            serviceUrl = serviceUrl + ";interface=wifi";
               
        HttpTransport ht = new HttpTransport(serviceUrl);
     
        ht.debug = true;
        ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
       
        try
        {
            ht.call(soapAction, envelope);        ---------> after executing this i got time out exception
            result = (envelope.getResult()).toString();           
            System.out.println("result........."+result);
            return result;
        }
        catch(org.xmlpull.v1.XmlPullParserException ex2)
        {
            System.out.println("XmlPullParserException........."+ex2);
        }

kums

******************************

Press kudos which the post help you
Please mark posts as solved if you got a solution
Developer
sonicboomboy
Posts: 466
Registered: ‎03-04-2009
My Device: 8520

Re: Webservice Call - Java.io.IOException : tunnel timed out.

A brief look through your source code allows me to say that in case you're connecting via wi-fi network it probably won't work properly as your serviceUrl variable will contain different suffixes.(both ";deviceside=true" and ";interface=wifi" ) Though it's not likely to be connected to your problem.

 

And HttpTransport class is not your own?

 

Got resolved! Press kudo icon!
Developer
kumaresan
Posts: 183
Registered: ‎12-17-2008
My Device: 8320

Re: Webservice Call - Java.io.IOException : tunnel timed out.

Hi sonic,

 

As same code working for me when i used to pass parameter like base64 in another webservice call.

 

SoapObject rpc = new SoapObject(serviceNamespace, "Image");
rpc.addProperty("ImgIn",base64); // base64 is string
rpc.addProperty("provider","4");

 

In another webservice i have to pass the byte[] .

so i converted byte array into string. like new String(byte[]);

 

rpc.addProperty("voice",new String(byte[]));

 

If i used like this it throws org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@d8e83741) exception

 

How could i solve this.

 

Note: if i pass " " empty string i got result. if i pass exact byte[] to string it throws exception.

 

 

kums

******************************

Press kudos which the post help you
Please mark posts as solved if you got a solution
Developer
sonicboomboy
Posts: 466
Registered: ‎03-04-2009
My Device: 8520

Re: Webservice Call - Java.io.IOException : tunnel timed out.

While constructing String object from byte array try to use String(byte[] bytes, String enc) with the specified encoding.

BlackBerry supports the following character encodings:

 

  • "ISO-8859-1"
  • "UTF-8"
  • "UTF-16BE"
  • "US-ASCII"
Got resolved! Press kudo icon!