You could override the TROBaseHTTPServer.ProcessRequest method.
There you can check the incoming request path and either let the channel process the request or provide own custom output (f.e. “WSDL is turned off”)
OnCustomResponseEvent event can be used only for cases when no dispatcher was found for an url. But I need to generate “WSDL is turned off” even when a dispatcher exists.
I’m not sure that I fully see your idea.
Please, could you give me a clue how to use OnCustomResponseEvent and not duplicate a lot of existing RO code?
simple code that works similar to registered dispatcher is
procedure TMegaDemoServerMainForm.ROIndyHTTPServer1CustomResponseEvent(
const aTransport: IROHTTPTransport; const aRequestStream,
aResponseStream: TStream; const aResponse: IROHTTPResponse;
var aHandled: Boolean);
var
op: TROResponseOptions;
b: TBytes;
begin
if SameText(aTransport.PathInfo, '/mysoap') then begin
aHandled := True;
// place for custom checks
MainProcessMessage((ROSOAPMessage as IROMessageCloneable).Clone,atransport,aRequestStream,aResponseStream,op);
aResponse.ContentType := aTransport.ContentType;
end;
end;
you can add any custom conditions, like checking for RODL/WSDL request:
if aRequestStream.Size = 0 then begin
b := StringToUTF8Bytes('WSDL is disabled');
aResponseStream.Write( b, Length(b));
Exit;
end;