Hi Amit,
If you defined a query in IGW and you need data based on the value you are passing, you could use custom script.
Write script to get the header values and map it to input.
Example is given below. Here I am getting the username, password and companyId from the header and mapping it to input.
function processRequestData(message) {
importPackage(java.lang);
importPackage(java.util); importPackage(org.apache.olingo.odata2.api.processor); importPackage(com.sap.gateway.ip.core.customdev.logging);
// Getting the header values passed with the request
var context = message.getHeaders().get("odatacontext");
var companyId = context.getRequestHeaders().get("companyId").get(0);
var username = context.getRequestHeaders().get("username").get(0);
var password = context.getRequestHeaders().get("password").get(0);
parentMap = new LinkedHashMap();
childMap = new LinkedHashMap();
childMap.put("key:companyId", companyId);
childMap.put("key:username", username);
childMap.put("key:password", password);
parentMap.put("key:credential", childMap);
message.setBody(parentMap);
return message;
}
Hence while testing from a rest client you need to pass the input in the headers as given below instead of embedding it with URL.
From a mobile app you need to do the same, add header while you make a request.
Regards,Midhun
SAP Technology RIG