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
Highlighted
New Developer
Posts: 5
Registered: ‎10-05-2009
My Device: Not Specified

HTTP-Request without web-APN from Vodafone throws exceptions

My first blackberry application should send some data to a http-server to display this data on a website. On sending the data I get a lot of exceptions using an APN different than the "web.vodafone.de".

 

Using the following settings: "TCP/IP-Settings" - APN-Settings unset -> results in "java.io.IOException: APN is not specified". Otherwise: APN-Settings activated an APN-field is empty -> results in "java.io.IOException: Tunnel failed".

 

Only setting the APN-field to "web.vodafone.de" results in a successful request.

 

This APN is an expensive on, so what do I have to change?

 

Here is my example code:

    private static boolean execRequest(Hashtable objData, String strUri)
    {
        boolean isSuccessfully = false;
       
        HttpConnection objHttpConn = null;
        InputStream objIncoming = null;
        StringBuffer strResponse = new StringBuffer();
       
        strUri += buildGetUri(objData);
       
        try {
           
            objIncoming = Connector.openInputStream(strUri);
                                   
            int intChar;
            while( (intChar = objIncoming.read()) != -1 )
            {
                strResponse.append( (char) intChar );
            }
           
            isSuccessfully = ( strResponse.toString().equals("succeeded") );
            _strResponse = strResponse.toString();
           
        } catch (Exception e) {
            Timerecorder.getInstance().debug("execSignin: " + e.toString() + "\n" + strUri);
        } finally {
            try {
                if( objHttpConn != null ) objHttpConn.close();
                if( objIncoming != null ) objIncoming.close();
            } catch(IOException objException) {
                Timerecorder.getInstance().debug("execSignin [finally]: " + objException.toString());
            }
        }
       
        return isSuccessfully;
    }

 

 Can anyobody help me,please? Maybe in german?

 

Thanks a lot.

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

Its worth reading this thread.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=29103


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

Can we confirm the following:

 

The issue here is not that it doesn't work with the APN settings.  it is that the APN route (Direct TCP) is very expensive and you are trying to find another way to send and receive?

 

Once you have reviewed the Thread BBDeveloper sent you to, you should be aware of the methods available to you, which I suspect in your case really come down to two options

a) WAP

b) Direct TCP

 

Do you have a WAP Browser on your Device?  Its presence would suggest that WAP was an option you could try.

New Developer
Posts: 5
Registered: ‎10-05-2009
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

yes, i've read the thread. if i understand it correctly, is a direct tcp connection without an apn route not possible - so far blackberry mds is not available. Because the device has no own IP, to get one, it needs to work with a proxy - in my case, with a carrier apn. is that correct?

I've already tried to establish a connection via WAP, but it also ends in exceptions. I'm still confused, is there no other solution to establish connections via http?

fyi: i've a blackberry storm 9500 test device for my application.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

The Storm has no WiFi, so can only talk Wireless talk (GPRS, EDGE, CDMA) and so needs a proxy.  Storms can have WAP, Direct or BIS-B connections depending on the gateway to the Internet they use.  That is it as far as I know.

 

Does the device have a Browser that works.  That is usually a good way to tell what Services you have (with the exception of Direct TCP).  Look at the Browser options, and see what is possible.

 

What exceptions did you get with WAP. 

New Developer
Posts: 5
Registered: ‎10-05-2009
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

yes, there is a fully working browser on the device. but there are no options which can help me anyway.

in the advanced options of the device i found an entry called "Service Book". there is a list with several booked services. like

  • "Blackberry Internet Browsing Service [BrowserConfig]"
  • "BlackBerry Maps [LbsConfig]"
  • "AIM-BBIM [BBIM]"
  • "IPPP for BIBS [IPPP]"
  • "IPPP for 5 Click [IPPP]"

 

all these services are active and have a gateway-ip. can this be helpful?

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

Re: HTTP-Request without web-APN from Vodafone throws exceptions

From these Service Records, the only access you have is BIS-B.  If you go into your Browser, use the menu to select Options, then Browser Configuration, the top line should have a 'pull down' that lets you choose which of the Browser options is the default.  I'm betting the only thing you see in that list is BlackBerry Browser.  In which case you don't have WAP (or are not provisioned for it).  So the only service you have ready access to is Direct TCP.  Sorry. 
New Developer
Posts: 5
Registered: ‎10-05-2009
My Device: Not Specified

Re: HTTP-Request without web-APN from Vodafone throws exceptions

Yes, u are right.

 

I've tried to add additional parameters to the connection string: ";deviceside=true;apn=blackberry.net"

But this results in a new exception: "net.rim.device.cldc.io.dns.DNSException: Error trying to resolve [uri]"

 

Is it anyway possible to use the settings of BIS-B Service Record in my own app?

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

Re: HTTP-Request without web-APN from Vodafone throws exceptions

Yes, if you are an Alliance member of Associate or above level - this costs money and requires a certain level of BlackBerry related activities.  However that might change, see

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=64519#M64519

 

Don't hold your breath, I'm picking it will not happen till the Developer Conference at the earliest!