Search code examples
sapui5

How to setup Mockserver and mockdata for XSJS service?


On the SAPUI5 Demokit I found the documentation for setting up the mockserver and mockdata when the datasource is xsodata service.

But I want to set up mockserver and mockdata where the manifest has no datasource and no model mentioned and I am setting up the default model in my controller with the help of JSON data returned by my Xsjs service which I call using jQuery.get().

But I am not able to find documentation regarding setting up mockdata and mockserver when the service is xsjs and it is not mentioned in manifest.

If anyone has any link or example on how to do this then it will be very helpful if you can provide with links.

Thank you.


Solution

  • Corresponding to this answer in the FAQ section it should be possible:

    https://help.sap.com/viewer/0ce0b8c56fa74dd897fffda8407e8272/7.5.9/en-US/c9a91ddaef47461c9c44bfc2198ea3f0.html

    Can the mock server be used for more than for OData service simulation?

    Yes. The mock server can be used to help you fake server response on any given API and stub all AJAX access to resources such as OData service, metadata, > annotation files (XML), other JSON or *.properties files.