1. #1
    Sencha User
    Join Date
    May 2012
    Location
    Bangalore
    Posts
    95
    Vote Rating
    1
    Rameshlamani is on a distinguished road

      0  

    Default How to consume external webservice in sencha touch2

    How to consume external webservice in sencha touch2


    Hi. i am new to sencha touch2. i want to consume external web service. i have written below code it is always going to failure alert msg not working! in console giving like this error msg like XMLHttpRequest cannot load http://localhost/SLS.BRND.Services/S...smx/Helloworld. Origin http://localhost:49692 is not allowed by Access-Control-Allow-Origin.
    Blog.js:29
    Object
    Blog.js:30Response Status:- 0


    My code is Here: Please help what is the problem

    Ext.define("GS.view.Blog", {
    extend: 'Ext.navigation.View',
    xtype: 'blog',
    config: {
    title: 'WebService',
    scrollable: true,
    items: [
    {
    xtype: 'button',
    text: 'Click Me',
    height: 40,
    width: 200,
    listeners: {
    tap: function () {
    Ext.Ajax.request({
    method: 'get',
    url: 'http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld',
    method: 'POST',
    params: {
    format: 'JSON:'
    },
    success: function (response, request) {
    alert('Working!')
    console.log(response);
    console.log('Response:-' + response.responseText)
    },
    failure: function (response, request) {
    alert('Not Working!')
    console.log(response);
    console.log('Response Status:- ' + response.status)
    }
    });
    }
    }
    }
    ]
    }
    });

  2. #2
    Sencha User
    Join Date
    Jan 2009
    Posts
    4
    Vote Rating
    1
    oportocala is on a distinguished road

      1  

    Default


    It sounds like a cros domain communication issue.

    You can look into Sencha's JSONP Proxy if you can modify the webservice to support JSONP or CORS if you're feeling progressive.

    Also very IMPORTANT: If you plan on packaging your client as a App using PhoneGap or whatever you need to know that cross domain limitations don't apply. Same happens when you open the index file directly in your browser, it will stop caring about cross-domain policy.

    If you're using Chrome you can disable these via a flag in its config. I used this and it worked for me: http://opensourcehacker.com/2010/11/29/disabling-cross-domain-security-check-for-ajax-development-in-google-chrome/

    Good luck

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar