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
Alan_Hollis
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Connection issues: HTTP 408 responses.

Hi Guys and Girls,

 

Wondering if any of the experts can give me some advice. We have one customer who is experiencing issues when connecting to our application via http.

 

What's weird is it works via gprs but not via 3g. The connection string being used each time is the same, which is confusing me too.

 

;deviceside=true;connectionUID=GTCP BIBS;ConnectionTimeout=20000

 The customer is behind a bes server, but I believe that the deviceside=true means that it's not using that to connect to the internet? Is that correct? 

 

I think this might be a carrier specific issue too as  my connection string looks like

 

;deviceside=true;connectionUID=WAP2 trans01;ConnectionTimeout=20000

 which works perfectly.

 

I get the connectionUID from this function:

 

	private static String getWap2Record()
	{
		ServiceBook sb = ServiceBook.getSB();
		ServiceRecord[] records = sb.findRecordsByCid("WPTCP");
		String uid = null;


		
		for(int i=0; i < records.length; i++)
		{
		    //Search through all service records to find the
		    //valid non-Wi-Fi and non-MMS
		    //WAP 2.0 Gateway Service Record.
		    if (records[i].isValid() && !records[i].isDisabled())
		    {

		        if (records[i].getUid() != null && records[i].getUid().length() != 0)
		        {
		            if 
		            ((records[i].getUid().toLowerCase().indexOf("wifi") == -1) && (records[i].getUid().toLowerCase().indexOf("mms") == -1))
		            {
		                    uid = records[i].getUid();
		                    break;
		            }
		        }
		    }
		}
		return uid;
	}
	

  Could this need changing?

 

 

 The full connection meathod if it helps is as follows.

 

	private static String getConnectionString()
	{
		//The Device is a simulator --> TCP
		if (DeviceInfo.isSimulator())
		{
			return ";deviceside=true;ConnectionTimeout=60000";
		}
		String st = "";
		//A carrier is providing us with the data service
		if ((CoverageInfo.getCoverageStatus() & net.rim.device.api.system.CoverageInfo.COVERAGE_BIS_B) == CoverageInfo.COVERAGE_BIS_B)
		{
			//WIFI
			if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_DIRECT,RadioInfo.WAF_WLAN, false))
			{
				st = ";interface=wifi";  
			}
			else
			{
				String uid = getWap2Record();
				if (uid == null)//couldn't find the right record
				{
					System.out.println("Couldn't find the right wap 2 record");
					uid = getBIBSRecord();
					if (uid == null)//couldn't find the right record
					{
						System.out.println("Couldn't find the right wap BIBS record record");
						st = ";deviceside=true"; // let the phone try to do the work
					}
					else
					{
						System.out.println("USING BIBS record record");
						st = ";deviceside=false;connectionUID=" + uid + ";ConnectionType=mds-p*blic";
					}
				}
				else
				{
					System.out.println("USING WAP2 record record");
					st = ";deviceside=true;connectionUID=" + uid;
				}
			}
		}
		else if ((CoverageInfo.getCoverageStatus() & CoverageInfo.COVERAGE_MDS) == CoverageInfo.COVERAGE_MDS)
		{
			st = ";deviceside=false";// use the clients blackberry enterprise server
		}
		else
		{
			st = ";deviceside=true";// let the phone do the work if it can
		}
		st = st + ";ConnectionTimeout=20000";
		
		EventLogger.logEvent(Long.parseLong("100".trim()),st.getBytes());
		
		System.out.println("Connection STRING"+st);
		
		return st;

	}

 Any help would be very much appreciated.

 

Thanks in advance

 

Alan

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection issues: HTTP 408 responses.

This is a weird one.  I must admit I really have no idea.  I have some 'debugging steps I would go through in your position, but honestly I have no certainly that these will help.  I could be wasting your time.

 

First some answers:

 

"The customer is behind a bes server, but I believe that the deviceside=true means that it's not using that to connect to the internet? Is that correct? "

This is my understanding too.  However for BES customers, I always connect via BES so I would change your code around and always check for BES first, and use it before you check for any other type (including WiFi, because BES will be routed over WiFi if it can be).  . 

 

";deviceside=true;connectionUID=WAP2 trans01;ConnectionTimeout=20000"

The ConnectionTimeout parameter is, as far as I know, not used for this connection type,  Have you tested that it actually does anything useful?  If it does not, I would remove it.  The only type that I think it works on is BES.

 

"((CoverageInfo.getCoverageStatus() & net.rim.device.api.system.CoverageInfo.COVERAGE_BIS_B) == CoverageInfo.COVERAGE_BIS_B"

you use this test before you go into your WAP test code.  BIS-B is not WAP.  You need COVERAGE_DIRECT if you want to confirm that WAP might be there. 

 

Now what to do.  This is very interesting:

"What's weird is it works via gprs but not via 3g."

 

As you have probably gathered 408 indicates some routing Server has tried to connect onwards and managed that but not had a response and so canned the request off.  The trick is finding out which Servers are involved.  You only see the two ends.  But if you have some logging at your Server end to see if you can tie a request in with activity from this user that would be useful. 

 

I'm guessing the carrier has different gateways for 3G connectivity compared with gprs and this is the differences. So perhaps you need to speak with the carrier.

 

One final thing, there are a number of other Threads that discuss, mostly inconclusively, 408 response codes.  have a look through these, perhaps there is something of use.

Please use plain text.
Developer
Alan_Hollis
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Re: Connection issues: HTTP 408 responses.

Hi Peter,

 

You have no diea how much I appreciate this response!

 

Unfortunately the requests don't even make it to our backend server when the customer uses the 3g connection. So I have no logging there. I may try calling the carrier, but I've not had much luck getting through to the right people before.

 

I'll definitely give a go of flipping around the connection to the BES logic as most of our customers who use this app will have a BES server setup, hopefully that will work in the interim.

 

I'll update this thread as and when I find isssues, I also searched through these forums but didn't find anything which resembled this problem.

 

Many thanks again.

 

Alan

Please use plain text.
Developer
Alan_Hollis
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Re: Connection issues: HTTP 408 responses.

Update:

 

Released a new version of the software swapping around the connection logic to use the BES first. Quote from customer

 

"This version logs in first time every time."

 

Definitely something at the carrier end. I guess this doesn't fully resolve the issue, and I'll fire off an email to o2 anyway to ask them if they have any reason why this maybe the case. Lets see how lucky I get with the response.

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: Connection issues: HTTP 408 responses.

[ Edited ]

Excellent!  A problem circumvented is a problem solved in my opinion!  I'm a glass half full kind of guy!

 

BTW, is this O2 UK?  Think knowing the carrier might be useful info for others who might have the same problem on the same carrier. Or did you already say that and I've just missed it.  if so sorry. 

Please use plain text.
Developer
Alan_Hollis
Posts: 53
Registered: ‎11-13-2009
My Device: Not Specified

Re: Connection issues: HTTP 408 responses.

[ Edited ]

hah! Sounds like a good way to be :smileyhappy:. Plus I have a happy customer which makes me happy. You're right in stating this is O2 UK as the carrier. I have this sneaky suspicision in my tummy that it's something to do with 3g and HTTPS combined together which is causing this.

 

I've tried calling their support lines and although the person I spoke to was very helpful this was a little too indepth for  him to give me an answer. He said I could book a "guru" for 25 minutes at an o2 store, but I'm not entirely sure this is going to be in the guru's remit either. You never know though!

 

p.s thanks again for taking the time to reply!

Please use plain text.