Hello,
I need to call an external rest service from a SBM modscript (which is called by a notifiication).
I create a rest data source with the basic auth.
I create a script but the response is an error 500.
I try to call the URL of the endpoint with SOAPUI on SBM server and it's OK.
I added the authentification in the "Headers vector" but the result is the same with or without the authent in the header.
Can you help me to figure out this case ?
Here is the script :
var issueID = Variant();
var itemMaint = Ext.CreateAppRecord(Ext.TableId("UMA_MAINTENANCE"));
itemMaint.Read(Shell.ItemId());
issueID = itemMaint.GetFieldValueString("TS_ISSUEID");
//Ext.LogInfoMsg("Cindy test modscript maint : issueID =" + issueID );
var restSource = Ext.CreateAppRecord(Ext.TableId("TS_RESTDATASOURCE"));
restSource.ReadByColumn("NAME","Update");
var result = "";
if ( !restSource.Post( result,"",[Pair("ticketId", issueID)],[],[Pair("Authorization","Basic xxx")] ) ) {
// write an error to Event Viewer
Ext.LogErrorMsg("IA - Rest call failed in script " + __FILE__ + ":\n" + Shell.GetLastErrorMessage() );
}
else {
Ext.LogInfoMsg("IA - Return rest call update : " + result);
}
And here is the error on the event viewer :
RESTDataSource::CallRest
URL: https://xxx/sbmproxy/xhp?url=httpsxxx
Return: false
ResultDataSize: 100
TimeoutVal: 30
ErrorMessages: HTTP Response Code: 500