Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
SOAP
Client Applications
Components
Interface
Interoperability
Server Applications
Transfers
UDDI
Wizards
WSDL Importer
WSDL Importer- BCB
WSDLImp.exe
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/SOAP/Components
[ Add a report in this area ]
Report #:
14046
Status:
Closed
TRIO.DoBeforeExecute - ignoring changes to var passed to event handler
Project:
Delphi
Build #:
2600
Version:
10.0
Submitted By:
daniel sr
Report Type:
Basic functionality failure
Date Reported:
6/29/2005 1:45:05 PM
Severity:
Commonly encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All platforms
Internal Tracking #:
226591
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
Duplicate of:
None
Voting and Rating
Overall Rating:
(2 Total Ratings)
5.00 out of 5
Total Votes:
2
Description
The TRIO.DoBeforeExecute method ignores any changes made in the FOnBeforeExecute event hanlder. If the developer made changes to the ReqW: WideString var passed to the event handler, it just gets ignored.
Here is the method as distributed in BDS2005. (Same bug in Delphi 7)
procedure TRIO.DoBeforeExecute(const MethodName: string; Request: TStream);
var
StrStrm: TStringStream;
ReqW: WideString;
begin
if Assigned(FOnBeforeExecute) then
begin
{ Ideally we would change the signature of this event to take a Stream.
The change to stream was necessary for attachment and encoding support.
And it makes the event consistent.... However, for the sake of
backward compatibility.... }
StrStrm := TStringStream.Create('');
try
StrStrm.CopyFrom(Request, 0);
Request.Position := 0;
ReqW := StrStrm.DataString;
FOnBeforeExecute(MethodName, ReqW);
finally
StrStrm.Free;
end;
{ NOTE: We ignore the var WideString passed in... ???? }
end;
end;
Here is the fix that Deepak posted for me in the newsgroups:
In the RIO.Pas, in the TRIO.DoBeforeExecute method, AFTER the following line:
{ NOTE: We ignore the var WideString passed in... ???? }
add:
// DEEPAK
Req := ReqW;
StrStrm := TStringStream.Create(Req);
try
StrStrm.Position := 0;
Request.CopyFrom( StrStrm, 0 );
finally
StrStrm.Free;
end;
{note: Declare Req:string and StrStrm: TStringStream; as local
variables}
Steps to Reproduce:
1) Assign an OnBeforeExecute event handler to a THTTPRio component.
2) Modify the SOAP XML Request using the DOM in the OnBeforeExecute event handler.
3) Verify on the server that your SOAP XML has been unchanged.
Workarounds
In the RIO.Pas, in the TRIO.DoBeforeExecute method, AFTER the following line:
{ NOTE: We ignore the var WideString passed in... ???? }
add:
// DEEPAK
Req := ReqW;
StrStrm := TStringStream.Create(Req);
try
StrStrm.Position := 0;
Request.CopyFrom( StrStrm, 0 );
finally
StrStrm.Free;
end;
{note: Declare Req:string and StrStrm: TStringStream; as local
variables}
Attachment
None
Comments
Registered User at 8/15/2006 10:53:20 AM
-
The proposed solution to this problem does not work if the stream comes from a mime attachment (GetMIMEStream). Request.CopyFrom( StrStrm, 0 ) returns the following error: "Method not supported".
From rio.pas:
{$IFDEF ATTACHMENT_SUPPORT}
if BindingType = btMIME then
DoBeforeExecute(MethMD.Name, AttachHandler.GetMIMEStream) //Gives the error
else
{$ENDIF}
DoBeforeExecute(MethMD.Name, Req); //OK
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us