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
MobileMetta
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800

HttpConnection communications

Hi,

 

I was informed that the transport needs to be specified in the HttpConnection URL.

 

For example, if I want to use WiFi I would need to append ";interface=wifi" onto the end of the URL, like this:

 

http://www.google.com;interface=wifi

 

Is this true?

 

If true, does it only pertain to certain versions of the OS?

 

Currently, I get a "DNS error" when I suffix the URL in this way.

 

I would like to understand why I get a "DNS error" and how to correct my code so WiFi is used whenever possible.

 

Thank you.

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

Re: HttpConnection communications

The BB uses a 'connection suffix' to specify the communication path that then request will be directed over.  To understand the possible options see this video:

http://supportforums.blackberry.com/t5/Java-Development/Networking-Transports-II/ta-p/446742

 

This KB article details the available suffixes:

http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-con...

 

Now I recommend that instead of worrying about which suffix to use, you can use ConnectionFactory and let it worry about it for you.

 

There is more on this recent Thread:

http://supportforums.blackberry.com/t5/Java-Development/Get-string-from-url/td-p/2099773

 

Now this doesn't specifically help you.  In your case you have chosen WiFi and correctly specified the connection suffix that will direct your request over WiFi. 

 

I have not really studied it, but I have seen DNS issues on device when they have been recently switched to WiFi.  My experience is that this will settle down.  My impression of this processing is that the WiFi routing actually attempts to resolve the IP Address for itself.

 

But this is hypothetical.  Can you tell us more about the environment for your DNS error.  Is it on device or Simulator?  What OS Levels are involved in development and on device/Simulator?  Does it take 2 minutes to get this error or does it happen quickly.  What is the URL you are trying to reach?  Is the URL accessible on the device's Browser? 

Contributor
MobileMetta
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800

Re: HttpConnection communications

Thank you very much for your very informative and helpful post, Peter.

 

>  Can you tell us more about the environment for your DNS error.

 

Absolutely.

 

> Is it on device or Simulator?

 

Device -- Torch 9800

 

>  What OS Levels are involved in development

 

5

 

> and on device/Simulator?

 

6

 

>  Does it take 2 minutes to get this error

> or does it happen quickly.

 

It takes a while (perhaps 2 minutes).  It seems like a connection timeout.

 

>  What is the URL you are trying to reach?

 

http://omniscience.cloudapp.net/collector/service.svc/Register/1

 

>  Is the URL accessible on the device's Browser?

 

Absolutely.

 

 

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

Re: HttpConnection communications

OK, All looks like it should work.

 

I'm not sure I can really help here, but I would like to do some more investigation.

 

In Manage connections, turn everything off, then turn WiFi back on.  Leave it for a bit until the WiFi indicator is showing.  Then try again in Browser and in program. 

Contributor
MobileMetta
Posts: 10
Registered: ‎01-22-2013
My Device: Torch 9800

Re: HttpConnection communications

Thank you for trying and for the additional information in your initial reply.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection communications

Sorry that should have read:

 

I would like you to do some more investigation.  Please try out the Manage Connection test.