Access the source TWebRequest object on a Delphi SOAP server

Summary. How do you access the source TWebRequest object in a soap Delphi server application?

My web service publishes an ITest service using the CallMe method:

 ITest = interface(IInvokable) ['{AA226176-FFAD-488F-8768-99E706450F31}'] function CallMe: string; stdcall; end; ... initialization InvRegistry.RegisterInterface(TypeInfo(ITest)); 

This interface is implemented in the class:

 TTest = class(TInvokableClass, ITest) public function CallMe: string; stdcall; end; ... initialization InvRegistry.RegisterInvokableClass(TTest, TestFactory); 

How do I access the source TWebRequest object inside the implementation of this method? For example. If I want to check which cookies were set, or read other properties in the request:

 function TTest.CallMe: string; begin // how to access TWebRequest object ... end; 
+7
source share
1 answer
 uses System.SysUtils, Web.HTTPApp, Soap.WebBrokerSOAP; function TTest.CallMe: string; var WebDispatcher: IWebDispatcherAccess; begin Result := ''; if Supports(GetSOAPWebModule, IWebDispatcherAccess, WebDispatcher) then Result := Format('You are calling me from: %s', [WebDispatcher.Request.RemoteIP]); end; 
+4
source

All Articles