IP Adress in service implementation

Hi everybody,

I just tested the XDataSwagger Demos, and I need to know if in service implementation of a method (let's say Add method) is there any way to get Headers of the call and the IP Address that did the request.

function TArithmeticService.Add(A, B: Double): Double;
var ip: string;
ip := '??'; // how to get the ip address of this call?
Result := A + B;


Hi there,

Yes, you can use TXDataOperationContext to do that (unit XData.Server.Module)

IP := TXDataOperationContext.Current.Request.RemoteIp;

TXDataOperationContext.Current.Request has other useful information about the request you may be interested in


1 Like

Thanks a lot, it works .


1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.