Results 1 to 3 of 3

Thread: consume a web service with sencha touch 1

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
      0  

    Default consume a web service with sencha touch 1

    SALAM all.
    please i want to soncume a web service made with WCF, with sencha touch 1.
    here is a link to my web service 'http://localhost:8732/Service1/data/10' its return a JSON file
    {"Id":10,"Name":"Leo Messi"}


    Now i want to consume it with sencha touch 1, i try few code but without success.
    please please how can i consume it. its very important for me.
    thank you

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,050
    Answers
    3976
    Vote Rating
    1381
      0  

    Default

    Are you launching the app from localhost:8732? If so, you can use ajax with no problems. If not then you need to use jsonp or the scripttagproxy and have the JSON returned within the callback function specified in the request.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    1
      0  

    Default

    thank you michelle.
    but the problem that i don't know how using jsonp or the scripttagproxy with sencha 1. in the kitchen of sencha they do it it with sencha2.
    I know Ibother youa bit but,can you correct methis code?
    Code:
    var App = new Ext.Application({
        name: 'webservice',
        useLoadMask: true,
        launch: function () {
    alert ("test json begin");
    
    
    
    
    
    
    				   
    	webservice.views.show = new Ext.Ajax.request({
                id: 'show',
                items: [{
                  xtype: 'panel',
                  id: 'JSONP',
                  url :'http://localhost:8732/Service1/data/10',
                  success : function() 
                    {
                         tpl= new Ext.XTemplate([
                            '<div >',
                                 '<tpl for=".">',
                                   '<div >',
                                     '<div class="Id">{Id}</div>',
                                     '<span class="Name">{Name}</span>',
                                   '</div>',
                                  '</tpl>',
                              '</div>'
                             ]);
                     }
                method: 'Get',
                  }]
    
    
    
    
            });
    
    
    
    
    webservice.views.Viewport = Ext.extend(Ext.Panel, {
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide',
    items: [webservice.views.show]
    
    
    });
    
    
    
    
    
    
    }
    });
    thank you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •