1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    0
    zied jouini is on a distinguished road

      0  

    Default Unanswered: consuming a web service with sencha touch

    Unanswered: consuming a web service with sencha touch


    SALAM all.
    i try to consume a web service.
    i download a code from the kitchen of sencha and i tried to execute it but the only thing that display is an alert which i put it in the beginning of the code. here is the code which i wrote:
    Code:
    var App = new Ext.Application({
        name: 'webservice',
        useLoadMask: true,
        launch: function () {
    alert ("test json begin");
    
    
    webservice.views.service = new Ext.Container({
    
    
    config: {
          scrollable: true,
          items: [{
                  xtype: 'panel',
                  id: 'JSONP'
                  },
                  {
                  docked: 'top',
                  xtype: 'toolbar',
                  items: [{
                     text: 'load using json-P',
                      handler: function() {
                       var panel = Ext.getCmp('JSONP'),
                         
                         tpl= new Ext.XTemplate([
                            '<div class="demo-weather">',
                                 '<tpl for=".">',
                                   '<div class="day">',
                                     '<div class="date">{date}</div>',
                                     '<tpl for="weatherIconUrI">',
                                        '<img src="{value}">',
                                     '</tpl>',
                                     '<span class="temp">{tempMaxF}°<span 
    
    
    class="temp_low">{tempMinF}°</span></span>',
                                   '</div>',
                                  '</tpl>',
                              '</div>'
                             ]);
    
    
                       panel.getParent().setMasked({
                           xtype: 'loadmask',
                           message: 'Loading ......'
                      });
    
    
                      Ext.data.JsonP.request({
                         url: 
    
    
    'http://free.worldweatheronline.com/feed/weather.ashx',
                         callbackkey: 'callback',
                         params:{
                             key: '23f6a0ab24185952101705',
                             q: '94301',
                             format:'json',
                             num_of_days:5
                                },
                      callback: function(success, result) {
                           var weather = result.data.weather;
                           if (weather) {
                                panel.updateHtml(tpl.applyTemplate(weather));
                                        }
                           else {
                               alert('error retrieving weather');
                                }
                          panel.getParent().unmask();
                         }
                       });
                   }
                }]
              }]
            }
    
    
    
    
    });
    
    
    
    
    
    
    webservice.views.Viewport = Ext.extend(Ext.Panel, {
        fullscreen: true,
        layout: 'card',
        cardSwitchAnimation: 'slide',
    items: [webservice.views.service]
    
    
    });
    
    
    }
    });
    it's very important for me. please help me

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    435
    Answers
    3106
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Are you using Sencha Touch 1 or 2?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    0
    zied jouini is on a distinguished road

      0  

    Default


    i'm using sencha touch 1

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,624
    Vote Rating
    435
    Answers
    3106
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    I just see you use the config object which in this usage won't work with ST1 or ST2 but it's a ST2 thing for using Ext.define.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    0
    zied jouini is on a distinguished road

      0  

    Default


    and how can i consume a web service with sencha 1 ?? what kind of modification should i to do ?

  6. #6
    Sencha User
    Join Date
    Mar 2012
    Location
    Tunisia
    Posts
    74
    Vote Rating
    0
    zied jouini is on a distinguished road

      0  

    Default


    pleaaaaaaaaaaaaaaaaaaaaase haw can i consume a web service with sencha 1