Using TLinkedRio
If you need to test your webservices before they're deployed, you needn't build a client. To test your functions, simply create a TLinkedRio, and cast it to your interface. The TLinkedRio will also store the XML passed in files (for debugging)
For instance, for a procedure named Yawn in an exposed Interface IICancelWait:
function TICancelWait.Yawn: string;
begin
Sleep( 10000 );
Result := 'Excuse Me';
end;
To test it in the service itself, you can drop a button in the Server form (this is a WAD project) and a label, with the following code in the button's handler:
procedure TForm1.Button1Click(Sender: TObject);
var MyRio : TLinkedRio;
begin
// use a TLinkedRIO
MyRio := TLinkedRio.Create(nil) ;
Label1.Caption := (MyRio as IICancelWait).Yawn;
end;
Notice that you don't need to free MyRio. A TLinkedRio will automatically get freed when it goes out of scope, if the Owner is null.
All you have to do is include the SoapLinked unit and the interface units in your server project.
You can even store the Request and Response in XML files to check the XML formatting or for other validations. Instead of Create, call CreateFile.
MyRio := TLinkedRio.CreateFile(nil,
ExtractFilePath(Application.ExeName)+'Req.xml',
ExtractFilePath(Application.ExeName)+'Resp.xml');
Note: Application.ExeName will only work for WAD executables. You need to use GetModuleFileName for ISAPI dlls, instead of Application.ExeName.