Skip to Content
Mar 06, 2019 at 04:46 PM

MockServer calling OData Service with function import parameter


Dear Expert,

Can any one tell me the real example for the SAPUI5 MockServer setRequests?


Default value is is[]

Each array entry should consist of an object with the following properties / values:

  • method : "GET"
  • path : "/path/to/resource"
    The path is converted to a regular expression, so it can contain normal regular expression syntax. All regular expression groups are forwarded as arguments to theresponsefunction. In addition to this, parameters can be written in this notation::param. These placeholder will be replaced by regular expression groups.

My example: Does it correct? and how to correct the issue if it is not correct?

path: new RegExp("GetProdsByAlertDate(.*), :storeId='0000000528' "),

  • response : function(xhr, param1, param2, ...) { }
    The xhr object can be used to respond on the request. Supported methods are:
    xhr.respondXML(iStatusCode, mHeaders, sXmlString). By default an XML header is set for response header

My example: Where should I handle the storeId parameter and how to assign a value to the parameter inside the function?

response: function(oXhr, storeId) {"");
var oAnnotations ={
url: sLocalUri,
dataType: "xml"

oXhr.respondXML(200, { },;
return true;