Skip to Content
avatar image
Former Member

Server Error

Hii all,

I am new to this technology. Actually i am trying to bind my table with odata service , which is working fine in gateway server .But it is showing me the error. I have attached the screen shot of my error file in chrome. PFA

Below is the code which i am using in eclipse.

<script>

  sap.ui.localResources("table");

  var view = sap.ui.view({

  id : "idFirst1",

  viewName : "table.First",

  type : sap.ui.core.mvc.ViewType.JS

  });

  view.placeAt("content");

  var tableo = new sap.ui.table.Table({

  title : "Indian Cricket Team",

  visibleRowCount : 5,

  selectionMode : sap.ui.table.SelectionMode.Single

  });

  tableo.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Sr No."}),

  template: new sap.ui.commons.TextView().bindProperty("text", "Srno"),

  width: "200px"

  }));

  tableo.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Player"}),

  template: new sap.ui.commons.TextView().bindProperty("text", "Player"),

  width: "200px"

  }));

  tableo.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Age"}),

  template: new sap.ui.commons.TextView().bindProperty("text", "Age"),

  width: "200px"

  }));

  tableo.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Country"}),

  template: new sap.ui.commons.TextView().bindProperty("text", "Country"),

  width: "200px"

  }));

  tableo.addColumn(new sap.ui.table.Column({

  label: new sap.ui.commons.Label({text: "Email"}),

  template: new sap.ui.commons.TextView().bindProperty("text", "Email"),

  width: "200px"

  }));

  var odatao = new sap.ui.model.odata.ODataModel(

  'http://smax.serveexchange.com:8000/sap/opu/odata/sap/ZODATA_TEAM_SRV'

//* false,

  // "s0122",

  //"Tirupati"

  );

  tableo.setModel(odatao);

  tableo.bindRows("/zteam_enity_typeSet");

  tableo.placeAt("content");

</script>

odataerror.PNG (29.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 29, 2015 at 05:44 AM

    Hi Mayank,

    Step1:

    var odatao = new sap.ui.model.odata.ODataModel(

      'proxy/sap/opu/odata/sap/ZODATA_TEAM_SRV'

    //* false,

      // "s0122",

      //"Tirupati"

      );

    Step2:

    Goto -Web.xml ----> add server proxy----> http://smax.serveexchange.com:8000

    <servlet>

      <servlet-name>SimpleProxyServlet</servlet-name>

      <servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class>

      </servlet>

      <servlet-mapping>

      <servlet-name>SimpleProxyServlet</servlet-name>

      <url-pattern>/proxy/*</url-pattern>

      </servlet-mapping>

      <context-param>

      <param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name>

      <param-value>{protocol}://{host name}:{port number}</param-value>

      </context-param>

    Refer: Use a SimpleProxyServlet for Testing to Avoid Cross-domain Requests - UI Development Toolkit for HTML5 (SAPUI5) - SAP Li…

    Thanks,

    Karthik A

    Add comment
    10|10000 characters needed characters exceeded