1
votes

Trying to call web service in Tizen, it works in Tizen web simulator but it doesn't work in the device.

  1. jQuery script linke added :

    src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"

  2. Internet privilege added:

    tizen:privilege name="http://tizen.org/privilege/internet

  3. Request jQuery:

    jQuery.ajax({
            url:"www.ServiceURL.com",
            type:"POST",
            beforeSend: function (request)
            {
                request.setRequestHeader("ver", "2.0.2217");             
            },
            processData: false,
            success: function(msg) {
                alert("jQueryPost :: Result");
            }
    });
    

it's work in the simulator but not responded in the device ?

1
failed with what error ? - Gabriele Petrioli
"Can't find variable jQuery" Please see the update - Basbous
this error points to the library not being correctly loaded, or that you code is running before the jquery loading.. (nothing to do with the service consumption) - Gabriele Petrioli
@GabyakaG.Petrioli In the simulator everything is OK, but in the real device nothing appear while i tested in the Chrome or firefox i got the following error " XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 406." - Basbous
have you enabled access to this resource in the config file ? (see stackoverflow.com/a/15125128/128165) - Gabriele Petrioli

1 Answers

1
votes

Any resource that it is accessed outside should be declared(see Accessing External Network Resources):

You cannot access external network resources by default (WARP: W3C Access Requests Policy). So, you must request permissions for the widget to retrieve network resources. You can enter several URLs by using the Add button on the Access tab. For each URL, you can indicate if you want to allow the widget to access the URL sub-domains. The Allow subdomain column contents can be toggled by mouse clicks. so it cannot work without having access to the specific resource needed in our case defined in config.xml:

<access origin="http://url_resource" subdomains="true"/>

or

<access origin="*" subdomains="true"/>

to let everything pass.

Reference