I have a warning in my code that I can’t figure out how to remove. The method is a utility method that is invoking THTTPRIO’s FConverter field’s IOPConvert.ProcessResponse method.
There are several overloaded versions of ProcessResponse in IOPConvert, and the one that is declared with parameter type InvString as the first parameter is the deprecated one.
Throughout the Delphi SOAP RTL, the trend has been away from String types and towards stream types, since Delphi 7, up to now (Delphi XE/XE2).
The question is WHY? In this case I can’t even figure out how to convert my helper code unless I add an ugly string-stream wrapper:
TRIOHelper = class helper for THTTPRIO
public
function HelperMethod(aMethName: String; aSoapString: String) : TRemotable;
end;
function TRIOHelper.HelperMethod(aMethName, aSoapString: String): TRemotable;
var
tmpString:String;
begin
//FConverter is a field in THTTPRIO
tmpStr := GrievousXmlHackery(aSoapString);
FConverter.ProcessResponse(InvString(tmpStr), IntfMD, MethMD, FContext);
...
end;
The code above the deprecated call is tweaking an XML document (the SOAP response) and removing some problematic elements from the incoming stream. Yes, a hack. How should I change it,and why are strings bad in OpConvert?
I guess I need to make a String Stream or Memory Stream wrapper for tmpString? Note that in my case, the GrievousXmlHackery function removes the <encoding> tag when present, from the SOAP for evil reasons that remain unimportant here.
Unless there is something actually technically WRONG with the old methods and the string based apis, I’m going to put up with the warning. But if (like many places in the VCL), the deprecated warning also means “here be dragons”, I’d like to know about it.
I’m not familiar with Delphi’s SOAP implementation, but why can’t you just use a
TStringStreaminstead?