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
xalien
Posts: 11
Registered: ‎06-20-2012
My Device: 9930, 9300 (simulators are used)
My Carrier: - (simulator is used)

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

Hi guys!

 

We are developping mobile client for our application. For now it is just web site written on http+css+javascript.

We use AJAX POST requests. Everything works fine if we do not use MDS. If we do use MDS all our AJAX POST requests looks like being cancelled by MDS. If I change POST to GET everything works fine. 

This is actual only for 6.0 and 7.0 devices (tried several different models including 9810, 9930, 9800)

On 5.0 devices all AJAX POST requests work fine.

 

Could anyone please shed a bit of light on this issue?

Thanks a lot for any idea.

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 822
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

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

Can you provide an example request? What is the actual response/response code that you get?

Tim Windsor
Application Development Advisor II
Please use plain text.
Contributor
xalien
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!

 

Actually we tried many different variants of code including calls using jQuery.Ajax() and XmlHttpRequest. We played with different headers, urls etc. But no success. 

Also we found that AJAX POST request is cancelled by the phone itself (not by MDS) but only when phone is configured to work through MDS. When we turn MDS off behaviour doesn't change. AJAX POST request becomes cancelled immediately. If in this case (when MDS is off) we replace POST with GET then when we send request it hangs for a minute or so and then message appears - "there is no connection" or something like this.

 

One of the code snippet that doesn't work is 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
    </head>
    <script type="text/javascript" src="Scripts/jquery-1.7.1.min.js"></script>
    <script type="text/javascript" src="Scripts/json2.js"></script>

    <script type="text/javascript">
        function performPost() {
            var request = { UserName: 'SysAdmin', Password: 'metastorm', ServiceName: 'Metastorm BPM Server', ClientType: "Mobile" };

            $.ajax({
                type: "POST",
                url: "/bpmmobileservice/authenticationservice.svc/Login?format=json",
                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>

 We check the same on a live environment with the real BES and result is the same.

 

 

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 822
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

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

Is that the full URL? Is there anyway for me to test this here using a live device on my own BES?

Tim Windsor
Application Development Advisor II
Please use plain text.
Contributor
xalien
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

[ Edited ]

Please use http://194.105.144.18:8082/bpmmobileservice/authenticationservice.svc/Login?format=json

Actually we experience the same issue making requests to any url. Both same domain or cross domain requests fail.

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 822
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

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

I spent a bunch of time trying different things today, but I can't seem to reach that IP at all no matter whether I use a BES or even a device with no BES. Have you tried this anywhere else? Shouldn't the code sample work in a Browser too?

Tim Windsor
Application Development Advisor II
Please use plain text.
Contributor
xalien
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

I'm extremely sorry. There was power cut off this weekend in our office.

I put this html file to the server so you can just open it using url http://172.28.28.102/bpmmobile/test.html in your browser on device.

Press "Perform POST" button. If AJAX POST succeeds you will see "+" alert; "-" otherwise.

Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 822
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

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

Sorry, that's an internal IP - I can't reach that page.

 

I tried again with the other IP - I can reach it but not the 8082 port. All requests I make are failing to connect at all, regardless of the device.

Tim Windsor
Application Development Advisor II
Please use plain text.
Contributor
xalien
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

I'm sorry. Correct url is - http://194.105.144.18:8082/bpmmobile/test.html

You can also use this URL (we duplicated it on another server so you do not need to reach port 8082): http://panskidka.com.ua/test.html
Please use plain text.
BlackBerry Development Advisor
twindsor
Posts: 822
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Bell

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

Okay, now I've been able to test it. It looks like it's not going to work over MDS - is that a requirement for your project? 

 

Setting the config to not use MDS would resolve this, ie:

 

<rim:connection timeout="25000">
<!-- <id>MDS</id> -->
<id>BIS-B</id>
<id>TCP_WIFI</id>
<id>TCP_CELLULAR</id>
<id>WAP2</id>
</rim:connection>

Tim Windsor
Application Development Advisor II
Please use plain text.