Building a Web Service from Scratch with Delphi - Writing the Methods
(Page 2 of 4 )
We need to write our own methods, so I'm going to create two very simple methods to which this service will respond. Go to the interface unit and add the following two methods under the IMyWebServer class definition:
Procedure SetTxt(Const AValue : String); stdcall;
Function GetTxt : String; stdcall;
Then go to the implementation unit and under the TMyWebServer class definition add the following two lines:
Private
TheTxt : String;
And then under these two add the following:
Procedure SetTxt(Const AValue : String); stdcall;
Function GetTxt : String; stdcall;
Then in the implementation section of the unit, add the following code:
function TMyWebServer.GetTxt: String;
begin
Result := TheTxt;
end;
procedure TMyWebServer.SetTxt(const AValue: String);
begin
TheTxt := AValue;
end;
So, what does the code do? Well, one of them (settxt) gets parameters from the user and the other reads it and shows the data.
Next: Adding state >>
More Delphi-Kylix Articles
More By Leidago