Search code examples
sapui5manifest.jsonmockserver

SAPUI5 Problem with rootUri in Mock Sever


Thanks a lot to all of you, my friends for your help and advices. Guys, I think I solved the problem, almost. Just need your help with this moment: My Table get data from mock server, but doesn't show it to user. Instead of the rows it shows an empty table where the rows count is equal to the data in my mockserver file. I mean: At the moment, in "ZMA_BPSet" there'se 8 rows. Because of this you can see 8 rows in table. Can anybody help me?

Project Run!


Solution

  • rootUri is used to determine the path of the OData service that should by intercepted by the mock server. It should always correspond to the service uri of your OData service specified in manifest.json.

    So, if you have this in your manifest

    "dataSources": {
        "mainService": {
            "uri": "/sap/opu/odata/your-service/",
            "type": "OData",
            "settings": {
                "localUri": "localService/metadata.xml"
            }
        }
    },
    

    your mock server constructor should look like this:

    var oMockServer = new MockServer({
        rootUri: "/sap/opu/odata/your-service/"
    });
    

    Note that the rootUri must always have a trailing slash. If your service url in manifest.json does not have one, make sure that rootUri does.

    You don't have to change anything in your manifest.json. All test setups are done in mockServer.html and its referenced files.