使用ajax从sanchtouch调用SOAP Webservice

时间:2014-02-20 10:34:25

标签: ajax web-services soap

我有一个用sencha touch 1.1实现身份验证的表格

我尝试使用SOAP从webservices发送和获取数据,看起来我应该用ajax来做,但我不知道该怎么做。

<script type="text/javascript">
Ext.setup({
icon: 'icon.png',
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
glossOnIcon: false,
onReady: function() {

    var form;

    Ext.regModel('User', {
        fields: [
            {name: 'name',     type: 'string'},
            {name: 'password', type: 'password'},
            {name: 'rank',     type: 'string'}
        ]
    });

     Ext.regModel('Ranks', {
        fields: [
            {name: 'rank',     type: 'string'},
            {name: 'title',    type: 'string'}
        ]
     });

    var ranksStore = new Ext.data.JsonStore({
       data : [
            { rank : 'refeer',  title : 'Refeer'},
            { rank : 'player', title : 'Player'},
            { rank : 'federation',     title : 'Federation'}
       ],
       model : 'Ranks',
       autoLoad : true,
       autoDestroy : true
    });

    var formBase = {
        scroll: 'vertical',
        standardSubmit : false,
        items: [{
                xtype: 'fieldset',
                title: 'FIFA Portal',
                instructions: 'Please enter the information above.',
                defaults: {
                    required: true,
                    labelAlign: 'left',
                    labelWidth: '40%'
                },
                items: [
                {
                    xtype: 'textfield',
                    name : 'name',
                    label: 'Name',
                    useClearIcon: true,
                    autoCapitalize : false
                }, {
                    xtype: 'passwordfield',
                    name : 'password',
                    label: 'Password',
                    useClearIcon: false
                }, {
                    xtype: 'selectfield',
                    name : 'rank',
                    label: 'Log As',
                    valueField : 'rank',
                    displayField : 'title',
                    store : ranksStore
                }]
            }],
        listeners : {
            submit : function(form, result){
                console.log('success', Ext.toArray(arguments));
            },
            exception : function(form, result){
                console.log('failure', Ext.toArray(arguments));
            }
        },

        dockedItems: [
            {
                xtype: 'toolbar',
                dock: 'bottom',
                items: [

                    {xtype: 'spacer'},
                    {
                        text: 'Reset',
                        handler: function() {
                            form.reset();
                        }
                    },
                    {
                        text: 'Save',
                        ui: 'confirm',
                        handler: function() {
                            if(formBase.user){
                                form.updateRecord(formBase.user, true);
                            }
                            form.submit({
                                waitMsg : {message:'Submitting', cls : 'demos-loading'}
                            });
                        }
                    }
                ]
            }
        ]
    };

    if (Ext.is.Phone) {
        formBase.fullscreen = true;
    } else {
        Ext.apply(formBase, {
            autoRender: true,
            floating: true,
            modal: true,
            centered: true,
            hideOnMaskTap: false,
            height: 385,
            width: 480
        });
    }

    form = new Ext.form.FormPanel(formBase);
    form.show();
}
});
</script>

Web服务是由GlassFishServer 3.1部署的Java Web应用程序

0 个答案:

没有答案