Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
JavaScript
$.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
Updated 24-Sep-12 19:42pm
v2
Comments
Unareshraju 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 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

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;

});
 
Share this answer
 
Comments
Prantick 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 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 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 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 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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900