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


    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: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 () {
    method: 'get',
    url: 'http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld',
    method: 'POST',
    params: {
    format: 'JSON:'
    success: function (response, request) {
    console.log('Response:-' + response.responseText)
    failure: function (response, request) {
    alert('Not Working!')
    console.log('Response Status:- ' + response.status)

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



    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

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."