THttprio onBeforeExecute changing the soapRequest
        Posted  
        
            by adnan
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by adnan
        
        
        
        Published on 2010-05-11T22:21:36Z
        Indexed on 
            2010/05/11
            22:24 UTC
        
        
        Read the original article
        Hit count: 753
        
I've imported some wsdl for a project. i want to change the SoapRequest on HttpRio onBeforeExecute event, but as i changed the request, im getting some errors how can i change the request xml file with stringReplace function on this event.
i've tried to change the size of stream, i ve changed the encoding etc. but anyway it didnt work.
example
procedure TForm1.RiomBeforeExecute(const MethodName: string; SOAPRequest: TStream);
var
  sTmp                                  : TStringList;
begin
  sTmp:=TStringList.Create;
  SOAPRequest.Position := 0;
  sTmp.LoadFromStream(SOAPRequest);
  sTmp.Text := StringReplace(sTmp.Text,'blablaa','bla',[RfReplaceAll]);
  sTmp.SaveToStream(SOAPRequest);
  // blaa blaa...
end;
        © Stack Overflow or respective owner