on 04-23-2020 8:47 AM
Hi Team,
I am facing issue when trying to hit the GET request for oData service for production user service through Ajax call in iRPA. I used the template provided on Cloud factory store- production order completion.
below is sample ajax call which is getting generated through ajax call in template code and error.
{"ts":"13:09:07.173","ctx":"Action","action":"ctx.ajax.call","params[{"method":"GET","url":"http://hostname:port/sap/opu/odata/sap/API_PRODUCTION_ORDERS/A_ProductionOrder('XXXXXX')","contentType":"application/json","ignoreClientCertificate":true,"headers":{"Authorization":"Basic UlJBWVZFUk1BOlNvcHJhQDAx","x-csrf-token":"fetch","If-Match":"fetch"},"timeout":10000}],"parentId":94}
ts: '13:09:07.173'
ctx: 'Action' action: 'ctx.ajax.call' params: [0]: method: 'GET' url: 'http://hostname:port/sap/opu/odata/sap/API_PRODUCTION_ORDERS/A_ProductionOrder('XXXXX')' contentType: 'application/json' ignoreClientCertificate: true headers: Authorization: 'Basic UlJBWVZFUk1BOlNvcHJhQDAx' x-csrf-token: 'fetch' If-Match: 'fetch' timeout: 10000 parentId: 94
Error: status: 12175 statusText: 'A security error occurred' responseText: 'A security error occurred'
Note: There is no network firewall also behind that.
Hello,
It is possible there is an issue with the ctx.ajax call method. If this is the case, please use the following workaround :
var command = 'curl <your options in the CURL command here>'
try {
ctx.exec(command, 30000, function(res){
// do what you need here, once you got the result of the WS call
});
}
catch (ex){
ctx.log('error : ' + ex.message);
}
You can find the manpage of CURL here.
Note : cURL is included in Windows 10 (build 17063 and above). If you run an older version of Windows, you'll need to download and install cURL by yourself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jerome, From our clue and few days of stuggle I got to know how to work with Curl
https://blogs.sap.com/2020/07/14/working-with-sap-irpa-and-s-4-on-premise-system/?preview_id=1143429
Hello,
I am facing a similar issue when I call the back end Api from RPA I am getting the error " A security error is occurred" with return code 12175. I appreciate any help here.
Using Ajax call to call the Api.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi meghasyam.akula - If this is standard bot, then please change the cloud variable "IGNORE_CERTIFICATE_ERROR" to FALSE and see if it works. It worked for me. Kindly provide the update on what happens in your case so that we can look further.
Thanks & Regards
SR.
Hello,
Could you please post the piece of code you're using to call the service ?
Thanks,
J.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Below is code:
GLOBAL.step( {
invoke_get_api: function (ev, sc, st) {
var rootData = sc.data;
ctx.workflow('Production Order Completion', '8d1bc27e-444e-4bbe-aaf1-d424376b8e87');
// invoke_get_api
var url = sc.localData.systemUrl + sc.localData.Resources['settings']['api_get'] + sc.localData.listOfPos[sc.localData.Startloop].PO + "')";
var opts = {
"username" : sc.localData.credentials.Username,
"password": sc.localData.credentials.Password
}
function success(res, status, xhr) {
sc.localData.csrf = xhr.headers["x-csrf-token"];
sc.localData.etag = xhr.headers['ETag'];
sc.localData.cookies = xhr.headers["Set-Cookie"].split('; ')[0] + "; ";
sc.endStep(); // invoke_post_api
return ;
}
function error(res, status, xhr) {
sc.endStep(); // invoke_post_api
return ;
}
API.GET(url, opts, success, error);
}
and here is GET method:
var API = {
GET: function (url, opts, success, error) {
ctx.ajax.call( {
method: e.ajax.method.get, // it is implicit
url: url,
contentType: e.ajax.content.json, // input data are added in URL: '...?...&...'
ignoreClientCertificate:true,
headers: {
'Authorization': 'Basic ' + ctx.base64.encode(opts.username + ':' + opts.password),
'x-csrf-token':'fetch',
'If-Match':'fetch'
},
success: function (res, status, xhr) {
success(res, status, xhr);
},
error: function (res, status, xhr) {
error(res, status, xhr);
},
timeout:10000
});
},
User | Count |
---|---|
70 | |
26 | |
9 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.