wakanda

Wakanda how to use server method in mobile side?


To bind my data on the mobile side it works like this :

getHeros() {
    this.wakanda.getCatalog().then(ds => {
        ds['Superhero'].query({orderBy:"ID desc",pageSize:3}).then(collection => {
            this.favoriteSuperheroes = collection.entities;
        });
    });
}

But like this I work directly on the table. I have a method who provide me everything I want on the server side. The Wakand's documentation tells me to do it like this:

ds.Company.myDataClassMethod().then(function (result) {

});

It won't work, I can't call my method, someone can help me ?


Solution

  • If the query() on the table works for you while calling dataclasss method does not. A possible cause is that your class method is not set to available to the public.

    Please check whether the scope of the class method is set to "public". And test if your method can be accessed directly via REST: 127.0.0.1:8081/rest/Company/myDataClassMethod

    Update: add type "any" to ds solves the problem. It appears

    this.wakanda.getCatalog().then(ds:any => { 
        ds['Company'].myDataClassMethod().then(result => {
            //Work with Result Here
        }); 
     });