Action-Attributes in Services

Hello,

I am looking for a way to create custom attributes in XData. If the attribute is set in a service, it should be used to change a value in the header.

[ServiceContract, Route(‘misc’)]
IServiceMisc = interface(IInvokable)
[‘{2DA43016-AB6C-4905-8EC6-3E589A1E3BAF}’]
[HttpGet, MySpezial]
function GetString:String;
end;

If MySpezialAttribute exists, then something should be changed in the header, for example:

procedure MySpezialAttribute.execute;
begin
THttpServerContext.Current.Response.Headers.AddValue(‘x-xxx’,'1234');
end;

There is no simple way to do that, as the RTTI information about the service being executed is only available well, when the service is already being executed. So it doesn't make much sense to retrieve such attributes information from it.

I'd say it's simply easier that you just add the header from the method itself:

function TServiceMisc.GetString:String;
begin
  THttpServerContext.Current.Response.Headers.AddValue(‘x-xxx’,'1234');
end;