on ‎2019 Jun 05 1:01 PM
Hello,
My colleague has implemented Function Import which downloads data from a public repository and it works exactly how it should when called in browser
SERVER_NAME/GetProductInfoFromWebservice?N='9206'
returns correct data in XML, for example, product name, but when I'm trying to utilize it in SAPUI5 application
this._oODataModel.callFunction("/GetProductInfoFromWebservice",
"GET", {
"N": "9206"
},
null,
function(oData, oResponse) {
console.debug(oData);
console.debug(oResponse);
},
function(oError) {
console.debug(oError);
}
);
it doesn't do a thing. Nothing shows up on the console.
When I've tried to use read instead of callFunction returned object had only empty fields.
How do I correctly utilize Function Import in cases like this?
Request clarification before answering.
Hi,
i used the callFuntion like this :
var calledFunction = oModel.callFunction("/MyImportFunction",{
method : 'GET',
urlParameters : {
param1: value1,
param2: value2
},
success : function(oData, response){
...
},
error : function(){
...
}
});Note: if the function does not exist, the promise (calledFunction.contextCreated) is rejected so we do not go in the 'success' or 'error' callback from 'callFunction. That is why i add this code after the call:
calledFunction.contextCreated().catch(function(error){
...
});i hope it will help you
Regards
Fabrice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.