cancel
Showing results for 
Search instead for 
Did you mean: 

ExecuteRESTService timeout

09-17-2021 12:36 PM
nerevar Participant
1107 views 3 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hello

I am using an external webservice call to synchronise email between the SAP cloud for customer and SAP IAS.

For now I am testing with some hardcoded elements, and try to update the email field in SAP IAS via scim interface.

here is my script to do so in BeforeSave.absl



import ABSL;
import AP.PDI.Utilities;
import AP.Common.GDT;
import AP.PDI.bo;
var customerDB = Customer.Retrieve(this.InternalID);
var result_post: RESTCallResult;
var urlParams : collectionof NameAndValue;
var headerParams : collectionof NameAndValue;
var msg : LONG_Description;
var body : LANGUAGEINDEPENDENT_Text  ;
var headerParam: NameAndValue;


headerParam.Name = "Content-Type";
headerParam.Value = "application/scim+json";
headerParams.Add(headerParam);


body = "{\"emails\": [{\"value\": \""+this.AddressSnapshot.DefaultEMail.URI.content+"\","+
"\"primary\": true} ],\"schemas\":[\"urn:ietf:params:"+
"scim:schemas:core:2.0:User\",\"urn:ietf:params:scim:schemas"+
":extension:enterprise:2.0:User\",\"urn:sap:cloud:scim:schemas"+
":extension:custom:2.0:User\"],\"id\": \"P000005\"}";


headerParam.Name = "Content-Length";
headerParam.Value = body.Length().ToString();
headerParams.Add(headerParam);
this.CurrentCommon.IDP_LastError = "";
result_post = WebServiceUtilities.ExecuteRESTService("IDPSynchScenario","ExternalWebServiceIDP","PUT","/P000005",urlParams,headerParams, body,"");


if( result_post.Code == "200 " || result_post.Code == "201 " || result_post.Code == "202 " || result_post.Code == "204 ") // Any code of 2XX will be considered as successfull hence checking all the possible http codes
{
	return;
}
else
{
	this.Common.GetFirst().IDP_LastError = result_post.Content.Substring(0,120);
	// Raise error message and return
	//msg.content = "Webservice "+result_post.Content;
	//Err_Emp.Create("E",msg);
	return;
}

everything works smoothly in postman calling the scim service but I keep getting timeout errors in my absl script. And I have no way to debug this. Any ideas?



I followed everything is this blog

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee

Hi,

Based on the code snippet that you shared there is the parameter wrongly passed to WebServiceUtilities.ExecuteRESTService.

Your code says:

result_post = WebServiceUtilities.ExecuteRESTService("IDPSynchScenario","ExternalWebServiceIDP","PUT","/P000005",urlParams,headerParams, body,"");

Whereas ideally, it should be:

result_post = WebServiceUtilities.ExecuteRESTService("IDPSynchScenario","ExternalWebServiceIDP","PUT","/P000005",urlParams,headerParams,"application/scim+json
",body);

Basically, between headerParams AND body, there is another optional parameter(which system expects)called "contentType" which you forgot to pass. As a result, the system interprets "body" variable as contentType value and "" as body and so on which might be causing issues at runtime.

Hence, can you please try passing content type as "application/scim+json"?

BR

Saurabh

nerevar
Participant
0 Likes

That was it ! Thank you sir.

is the documentation/signature of this function somewhere in the SDK documentation ? because I could not find it 😕

I only worked from examples found online..

Have a nice day

Regards

former_member226
Employee
Employee
0 Likes

Glad that it worked for you.

Yes, there is official documentation on help.sap.com where SAP mentioned all the params for the method. Pls see: https://help.sap.com/viewer/cbcebe3cfb1647a8b0322c18dbb0b481/LATEST/en-US/75d2f40373e21014a153e5dcf2...

But my personal favorite is, SDK "Display Parameter Info" button, as shown:

Answers (0)