Maximilian Jung wrote:
Hi Simon,
I was facing the same issue a little while ago, and I did implement it the following way:
public static CustomServiceOutput CustomService(CustomServiceInput CustomServiceInput)
{
Utilities.StartMethod(OBJECT_TYPE_NAME, “CustomService”, new KeyValuePair<string, object>(“CustomServiceInput”, CustomServiceInput));
CustomServiceOutput CustomServiceOutput;
try
{
// Service Implementation was here
CustomServiceOutput = new CustomServiceOutput();
// Service Implementation was here
Utilities.EndMethod(-1, -1,
new KeyValuePair<string, object>(“CustomServiceInput”, CustomServiceInput),
new KeyValuePair<string, object>(“CustomServiceOutput”, CustomServiceOutput));
return CustomServiceOutput;
}
catch (Exception ex)
{
if(CustomServiceInput.DoThrowException)
{
throw;
}
CustomServiceOutput = new CustomServiceOutput();
Utilities.EndMethod(-1, -1,
new KeyValuePair<string, object>(“CustomServiceInput”, CustomServiceInput),
new KeyValuePair<string, object>(“CustomServiceOutput”, CustomServiceOutput));
}
finally
{
CustomServiceOutput = new CustomServiceOutput();
Utilities.EndMethod(-1, -1,
new KeyValuePair<string, object>(“CustomServiceInput”, CustomServiceInput),
new KeyValuePair<string, object>(“CustomServiceOutput”, CustomServiceOutput));
}
return CustomServiceOutput;
}
Not sure if that is the correct way to this - and therefore, should be used at the users own risk - but it works fine for me this way.
Hope it helps.
Best regards,
Maximilian