Skip to Content
avatar image
Former Member

CROSS ORIGIN ISSUE - Improper oData URL format

I am using proxy Servlet(attached below) and one handler(attached below) to resolve Cross origin issue.

Below is the code fragment I am using. But Its giving unexpected oData Url format due to which getting 404 error while reading the entity.

var loginId= sap.ui.getCore().byId("__xmlview0--loginId");

//its giving Entity set

var oModel = new sap.ui.model.odata.ODataModel("http://PO server:port num/MyApp/GWProxyServlet?sap/opu/odata/SAP/ZFK_ORD_HEADERDETAILS_SRV/");

//i am reading perticular entity

oModel.read("/EmployeeSet(empid='"+id+"')", null, null, false, function(oData){

oLoginJsonModel.setData(oData);

// In console unexpected URL format as below

http://PO server:port num/MyApp/GWProxyServlet?EmployeeSet(empid='"+id+"'sap/opu/odata/SAP/ZFK_ORD_HEADERDETAILS_SRV/"

Please suggest on this.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 03, 2015 at 06:35 PM

    wierd, that you have such an error in Console. Try to escape your path, e.g.

    var sURI = "/EmployeeSet(empid='"+id+"')";
    var sPath = escape(sURI);
    oModel.read(sPath, null, null, false, function(oData){
    ...
    });
    
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 07:24 PM

    try "/EmployeSet("+id.toString()+")" // without empid= inside the parenthesis

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 07:29 AM

    Hi Mohd,

    It could be a catch issue.

    Thanks,

    KA

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 03, 2015 at 08:40 AM

    its not catch issue i check it.

    Add comment
    10|10000 characters needed characters exceeded