Call @ExtDirectMethod methods from sencha touch android package

108 views
Skip to first unread message

Deepu kukreja

unread,
Oct 5, 2015, 3:53:16 AM10/5/15
to extdirectspring
Hi,

I am creating android app with sencha touch from where i want to call  @ExtDirectMethod method using ajex call or store load.

I have a server where i deployed extdirectspring framework and from sencha touch aap i want to access  @ExtDirectMethod methods which deployed on that server, please suggest me how can i access these methods.


Thank you 
Deepu kukreja

ralph

unread,
Oct 5, 2015, 7:38:07 AM10/5/15
to extdirectspring
Hi

There are different ways to do it. 

One way is to load the api defintion with a script tag
<script src="http://app.domain.com/api.js"></script>
and then configure the Direct Manager
 Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);


Or when you only have a few ext.direct server methods you can hardcode the definitions

 Ext.direct.Manager.addProvider({  
                    "url" : "http://app.domain.com/router",  
                    "type" : "remoting",  
                    "actions" : {
                          "logService" : [ { "name" : "log", "len" : 1 } ],
                          "navigationService" : [ {"name" : "getNavigation", "len" : 1} ]
                    });



In Ext Js 5 and 6 there is another way. With the function loaderProvider
 Ext.direct.Manager.loadProvider({
     url: 'http://app.domain.com/api.js',
varName: 'Ext.app.REMOTING_API'
});


Here is an interesting blog about loading the ext direct api

Ralph

Raj Namdeo(Sr. Software Engineer)

unread,
Oct 8, 2015, 7:57:37 AM10/8/15
to extdirectspring
Hi,

i am using  this way  
Ext.direct.Manager.addProvider({  
                    "url" : "http://app.domain.com/router",  
                    "type" : "remoting",  
                    "actions" : {
                          "logService" : [ { "name" : "log", "len" : 1 } ],
                          "navigationService" : [ {"name" : "getNavigation", "len" : 1} ]
                    });
but i am unable to call and  nothing else happen in browser  but i am change type :"remoting" to 'rpc' then 
facing the issue Uncaught Error: [Ext.Loader] Failed loading synchronously via XHR: 'direct/rpcprovider.js'; please verify that the file exists. XHR status code: 404
pls help me 
Thanks
Ramraj Verma

ralph

unread,
Oct 8, 2015, 8:27:08 AM10/8/15
to extdirectspring
Hi

Not sure why you want to change the type. But you can do that. You have to make sure that you write an implementation 
of the provider and the alias matches the type config 

type: 'rpc'   -->    alias: 'direct.rpcprovider'

Here is the source code of the remoting provider (type: 'remoting'): 

What happens when you call the service? Make sure that the number of arguments matches the len config

For instance (len = 1)

logService.log(parm1, function() {
  //callback
});
Reply all
Reply to author
Forward
0 new messages