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

Web and WebWorks Development

Reply
Contributor
Posts: 11
Registered: ‎06-20-2012
My Device: 9930, 9300 (simulators are used)
My Carrier: - (simulator is used)

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Actually we would like to have it working over MDS :-)
And my question was how to fix current situation as for now it doesn't work.
Contributor
Posts: 11
Registered: ‎06-20-2012
My Device: 9930, 9300 (simulators are used)
My Carrier: - (simulator is used)

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Could you please confirm that there is no way to make it working over MDS?

BlackBerry Development Advisor
Posts: 835
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Does the server get any connection at all from the request?

 

Can you try without the login and password data?

 

Can you turn your server on again so I can test against it?

Tim Windsor
Open Source Technical Lead
Contributor
Posts: 11
Registered: ‎06-20-2012
My Device: 9930, 9300 (simulators are used)
My Carrier: - (simulator is used)

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Hi Tim,

 

You can use http://panskidka.com.ua/test.html for your tests at any time as the server is always up.

I think I mentioned that it works on any device and any browser. It works over MDS on Blackberry 5.0 devices. It even works on 6.0 and 7.0 devices if we do not use MDS. But it doesn't work on 6.0 and 7.0 devices over MDS.

 

We tried to replace POST with GET and everything works fine. We tried to replace POST with PUT and everything works fine too. 

 

And it looks like request is cancelled by device rather than MDS.

We tried also the following:

1. Replace POST with GET

2. Ensure it works over MDS

3. Shutdown MDS

4. Try to make request again. Phone browser is showing progress about a minute or so and then displays message that no connection or something like this.

But if we tried the same with POST there is no message about absence of connection and no minute pause. Request just fails immediately.

 

The code is very-very simple. We simplified it to illustrate that nothing can cause this wierd behaviour except phones or MDS.

 

The contents of the test.html is the folowing:

 

 <html xmlns="http://www.w3.org/1999/xhtml">
 	<head>
 	      <title></title>
 	</head>
 	<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
 	<script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
 	 
 	<script type="text/javascript">
 	        function performPost() {
 	        var request = { UserName: 'SysAdmin', Password: 'metastorm' };
 	        $.ajax({
 	          type: "POST",
 	          url: "/bbtest.php",
 	          contentType: "application/json",
 	          data: JSON.stringify(request),
 	          success: function () {
 	            alert("+");
 	         },
 	         error: function () {
 	           alert("-");
 	        }
 	      });
 	    }
 	</script>
 	<body>
 	    <input type="button" value="Perform POST" onclick="performPost()"/>
 	</body>
</html>

 


As you see it post request to bbtest.php in the same domain. The contents of bbtest.php is below:

 

<?php
    $value = json_decode(file_get_contents('php://input')); 
    if($value["UserName"] == "SysAdmin" && $value["Password"] == "metastorm")
    {
        echo "+";
    }
    else
    {
        echo "-";
    }
?>

 

 

I would like to emphasize that it works on any platform and even on Blackberry devices when MDS is not used.

Developer
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Is it possible that there are some settings related to your BES (Proxy or other security settings) that are preventing this from working? It would be great to see the MDS logs...
Contributor
Posts: 11
Registered: ‎06-20-2012
My Device: 9930, 9300 (simulators are used)
My Carrier: - (simulator is used)

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Does it work correctly on your device over MDS? If it doesn't than it seems to me that settings of our MDS doesn't matter as you can reproduce it on your own environment.

 

Actually as I stated in this thread earlier it does work over the same MDS on 5.0 devices.

Moreover we use simulators for MDS and for phones but our collegues from London can reproduce this issue on their real devices working over corporate BES server.

 

We use following simulator of MDS: https://swdownloads.blackberry.com/Downloads/contactFormPreload.do?code=DC727151E5D55DDE1E950767CF86...

We just installed it and made no changes in settings or config. So it works with default settings.

 

The same situation is with devices. We just installed downloaded simulators and configure them to work over MDS.

We use simulators for 9800, 9930, 9810.

 

 

Developer
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

Can you try it after changing the JS include so that it is on your server rather then on some other domain. I know it doesn't make 100% sense but it's worth a try. The other thing I would try is to get your London colleagues to send you the MDS logs (start with the MDAT logs) from their real BES.
Contributor
Posts: 21
Registered: ‎07-24-2012
My Device: torch 9800
My Carrier: movistar

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

I am using these libraries in this order:

 

<script type="text/javascript" src="js/json2.js"></script>
<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>

And it works jquery post queries.

Developer
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

So it works via MDS?
Contributor
Posts: 21
Registered: ‎07-24-2012
My Device: torch 9800
My Carrier: movistar

Re: Problem with AJAX POST requests on 7.0 and 6.0 devices working through MDS

In my case I use:

- Webworks 2.3.1.5.
- PhoneGap 1.9
- HTML5
- Jquery 1.6.4.
- Jquery UI 1.8.21.

 

Works with MDS in the simulator and on devices with OS than 6.0.0.448.

 

In previous versions 6.0 produces a browser crash, even finding no solution to that.