Skip to Content
avatar image
Former Member

Consuming REST webservice into SAPUI5 App.

I am trying to consume REST Web service into my SAPUI5 Application.The webservice response is in JSON format. How do I bind the data coming in my application.

I get the Error : Failed to load resource: the server responded with a status of 404 (Not Found)

// The controller code is as follow :

onInit: function() {


url: "http://localhost:8080/sdnext/doj/webservice/json/employees/",

type: "GET", dataType: "text",

contentType: "text/json",

success: function(data, textStatus, jqXHR) { response = data; },

error: function(xhr, status) { console.log("ERROR"); },

complete: function(xhr, status) {

var oModel = new sap.ui.model.json.JSONModel(); oModel.loadData(response); this.getView().setModel(oModel);

} });

View is in the image attached for data Binding.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • May 05, 2017 at 01:51 PM

    i think the error msg is very clear.

    are u able to get any data if you put the url in browser?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 08, 2017 at 06:08 AM

    Hi Jun Wu,

    I am able to get the json data when I enter it in the browser. The webservice is working fine.

    I tried to make it work from my hana cloud web IDE but no luck there. Can you suggest any other way I can consume this web service into an SAPUI5 application? Maybe by Eclipse IDE ?



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      The REST web service I created and deployed it to my tomcat server , locally. (i.e localhost:xxxx). It is accessible when the tomcat server is on.

  • May 08, 2017 at 06:48 AM

    Hello Sushil,

    Could you please show how you are binding your table. Also check in your network tab for the response. If response is coming then there is an issue with table Binding.



    Add comment
    10|10000 characters needed characters exceeded

    • Hi Sushil,

      If in your employee json model data is coming then you will get the records in your table. Once you gets data from backend , set that data into json model and give a namespace employee.and then set the table with the jsonmodel.

      First requirement would be to get the data from the backend system.