This is a migrated thread and some comments may be shown as answers.

call web service

3 Answers 360 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
M Kumar
Top achievements
Rank 1
Iron
Veteran
M Kumar asked on 18 Jun 2014, 07:26 AM
Hi

from my login form i m calling a web service in our customer place, i was getting the error message like "the CROS is not allowed" something and recommend me to add the google chrome extension to enable cross call in google crome browser, i have installed the recommended extension but still i am getting the CROS error.

how can i access the web service in my local host from telerik platform, last time i can access my local host web service from icenium but now i don't how to test the web service in my local host.

Regards
Siva

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 20 Jun 2014, 04:35 PM
Hello Siva,

I am not sure how exactly you would like to test your web service, can you please elaborate on that a bit more?

Basically if the Simulator in the AppBuilder In-Browser client alerts you for possible CORS errors, this means that it detected issues with a web request sent from the app. In that case, if the issue is really CORS-related, Telerik AppBuilder Helper for Chrome will enable Ajax CORS requests for the device simulator to spare you the CORS errors.

However, please first check to see if you have encountered CORS issues. To do so please open the Chrome developer tools and check the Console for any errors. You can also check the Network tab to further examine the state of the web requests sent from the app.

Regards,
Tina Stancheva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
M Kumar
Top achievements
Rank 1
Iron
Veteran
answered on 27 Jun 2014, 02:39 AM
Hi Tina
Thank you for your quick reply
i want to test the web service in my local machine for example http://localhost/website/webservice.asmx

yes i have installed the Telerik AppBuilder Helper for Chrome but still i am getting CROS error. i can not test it in other browser. hope you understand my questions


0
Tina Stancheva
Telerik team
answered on 01 Jul 2014, 05:04 PM
Hello Siva,

I created a sample app on our side and I tested my service through the following sample post request:
$.ajax({
        url: 'http://myapp.com/myservice',
        headers: {
            "Authorization":"Basic " +"testUsername" + ":" + "testPass")
        }
});

and I was able to successfully pass the headers with my request. I used Google Chrome developer tools with the AppBuilder In-Browser simulator to make sure the headers are properly passed.

However, please note that if the request is coming from a domain different than the one it is targeting, then it will only be successful if the target's response contains an Access-Control-Allow-Origin header in it. This is why if your service is not configured to present such a header, an error message will be displayed in the Console of the browser's developer tools. The error will read: "No 'Access-Control-Allow-Origin' header is present on the requested resource."

This error indicates that when the request was sent, the browser couldn't find the Access-Control-Allow-Origin header. This is why only the OPTIONS request succeeds without sending a POST request at all.

Please open the console and make sure there is no such error. If there is, then the solution would be to add the Access-Control-Allow-Origin to the target domain. The approach for adding it, depends on the server/language behind that address. Sometimes a configuration variable in the tool will do the trick. Other times you'll have to add the headers through code yourself.

If you don't see any errors in the console, please send us a screencast or a screenshot of the network information available within the browser's developer tools. You can also run FiddlerCap (with the Decrypt HTTPS Traffic option enabled) before launching your app in the AppBuilder In-Browser client. This is a tool that will intercept the HTTP requests the simulator performs and give you the option to save them to disk. We will need the FiddlerCap capture to see the requests send on your side.


Also, please note that in order to test your local service on a device, you need to request it through the ip address of your machine.

Regards,
Tina Stancheva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
M Kumar
Top achievements
Rank 1
Iron
Veteran
Answers by
Tina Stancheva
Telerik team
M Kumar
Top achievements
Rank 1
Iron
Veteran
Share this question
or