Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Mobile Ajax Blackberry jQuery ASMX , +
I am working on a mobile native application in Blackberry WebWorks. My application runs on Tomcat 5.5 which fetches data from an ASMX webservice running on IIS 7.5. I am getting timeout after a timeperiod of 2mins during data-fetching operation. I can not over come this problem please help me to overcome. I am setting the ajax time out and in the config file I have also mentioned the timeout, still I am getting the timed out. I am posting the code snippet here below for your reference.
$.ajax({
        type: 'POST',
        url: "http://myurl:port/projectpath.action",
        data: formInput,
        dataType: "TEXT",
        timeout:600000,
        async: true,
        success:function(jqXHR, textStatus, errorThrown){
 
            alert("error :" + textStatus);
            alert("incoming Text :" + jqXHR.responseText);
            alert("What ErrorThrown :" + errorThrown);
            $('#loader').hide();
            window.location.replace("paymentResult.html");
        },
        error:function(jqXHR, textStatus, errorThrown){
 
            alert("error " + textStatus);
            alert("incoming Text " + jqXHR.responseText);
            alert("What ErrorThrown" +errorThrown);
            $('#loader').hide();
            //alert(xhr.status+"  Server Unavailable! Please try again later");
        }
    });
    return false;
 
});
 
I am getting the timeout through the below mentioned Ajax alert message.
alert("What ErrorThrown" +errorThrown);
 
In my config file, my parameters passed are:
 
"rim:connection timeout="600000""
"id"TCP_WIFI"/id"
"id"MDS"/id"
"id"BIS-B"/id"
"id"TCP_CELLULAR"/id"
"id"WAP2"/id"
"id"WAP"/id"
"/rim:connection"
 
Please help me.
 
Thanks in advance
Posted 24-Sep-12 20:40pm
Prantick1.2K
Edited 24-Sep-12 20:42pm
v2
Comments
Unareshraju at 25-Sep-12 1:45am
   
hi prantick ,
u can remove timeout:600000,async: true, then try again. because application it will take time from when we start the app. so that your getting this error.
so that remove and try again.
Prantick at 25-Sep-12 2:09am
   
Hi Unareshraju,
Thanks for your reply. I tried removing this tag as per your suggestion but it didn't work. I am getting the same error.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi Prantick ,
do the changes like this :
 
$.supports.cors=true;
$.ajax({
type: 'POST',
url: "http://myurl:port/projectpath.action",
data: formInput,
contentType:"text/html",
success:function(jqXHR, textStatus, errorThrown){
alert("error :" + textStatus);
alert("incoming Text :" + jqXHR.responseText);
alert("What ErrorThrown :" + errorThrown);
$('#loader').hide();
window.location.replace("paymentResult.html");
},
error:function(jqXHR, textStatus, errorThrown){

alert("error " + textStatus);
alert("incoming Text " + jqXHR.responseText);
alert("What ErrorThrown" +errorThrown);
$('#loader').hide();
//alert(xhr.status+" Server Unavailable! Please try again later");
}
});
return false;

});
  Permalink  
Comments
Prantick at 25-Sep-12 3:02am
   
it did not work. because the issue is app is getting timed out. There are several other web service calls in my application , they are working, only this service call is creating a problem as it is taking more than 2 minutes to respond. The blackberry MDS which uses the tcp call is set to default as 2 minutes, beyond that it will give time out. I want to increase that but don't know how?? please help me on that.
Unareshraju at 25-Sep-12 3:35am
   
before going that i have few questions.
1)are you using phonegap with BlackBerry?
2)if u r developing in phonegap, which version u r using?
3)is calling any webservice method in u r application?
4)which response type u r using either JSON or XML?
previously i was faced same issue ,i gave particular Response and content type after that my problem solved.
Prantick at 25-Sep-12 3:50am
   
1) I am using webworks, package my app with riplle version 9.0.16 using blackberry sdk version 2.3.1.15.
2.) yes i am using webservice method, it is working fine in other webservice methods , but for this method only it creating a problem as it is taking more than 2 minutes to respond,
moreover it is working fine in local browser as well as ripple simulator.
3.) JSON response...i have also tried out with JSONP...but the problem stays for this webservice cal only..
Unareshraju at 25-Sep-12 4:44am
   
ok thank you,
here is my working code :
 

$.support.cors = true;
var pval="passing value to webmethod";
$.ajax({
type: "POST",
url: "http://localhost:portno/Service1.asmx/webmethod",
data: JSON.stringify({ pval: pval}),
contentType: "application/json; charset=utf-8",
dataType: "JSON",
error: function (request, status, error) {
alert( 'Error : ' + error); },
success: function (msg) {
var theRealData = msg.d;
document.getElementById("welcomeMsg").innerHTML += theRealData;
}
});
Prantick at 27-Sep-12 0:01am
   
Thanks Unareshraju for your help.
Now I am getting an error message as "TCP/IP server timeout error" during my call to the webservice hosted in IIS residing on the same server where the Apache Tomcat 5.5 app is running. The call from my blackberry appwork app to the tomcat server is going through a Global IP of the server. Please help me in thsi regard. Thanks in advance
PINKS25 at 26-Sep-12 14:23pm
   
I have same kind of application. I am getting "TCP/IP server timeout error" in my application while trying to fetch data from webservice which takes more than 2mins. My application is opened through a global ip and there is firewall. Please enlighten me.
Unareshraju at 27-Sep-12 1:23am
   
hi there,
here the problem is not your application, pls check the firewall/iis
see here: http://support.microsoft.com/kb/191143
Prantick at 28-Sep-12 3:58am
   
Thank you so much Unareshraju. I have implemented whatever you have mentioned in your reply. IIS is working properly. Removed firewall, still I am getting the error.Is there any way to increase timeout in tomcat app if it doesn't get response from remote upstream server within a certain time?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Richard MacCutchan 269
1 Aajmot Sk 252
2 Marcin Kozub 235
3 Sergey Alexandrovich Kryukov 185
4 Praneet Nadkar 167
0 OriginalGriff 7,913
1 Sergey Alexandrovich Kryukov 7,232
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,865


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100