call web service

4 posts, 0 answers
  1. M Kumar
    M Kumar avatar
    40 posts
    Member since:
    Apr 2008

    Posted 18 Jun 2014 Link to this post

    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
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 20 Jun 2014 Link to this post

    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.

     
  3. M Kumar
    M Kumar avatar
    40 posts
    Member since:
    Apr 2008

    Posted 26 Jun 2014 in reply to Tina Stancheva Link to this post

    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


  4. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 01 Jul 2014 Link to this post

    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.

     
Back to Top