- Set the property SOAPCallOK to True
- uses InvokeRegistry, webLink{, webSOAPDispatch}
- Decide whether you want to publish the Execute method, and/or open other procedures and functions. Generally we recommend using other
procedures and functions so that you can specify the parameters clearly.
- Make a derived class which indicates the methods to be published. The first example does not publish the Execute method:
IWebZipCodeLookup = interface(IWebAction)
// hint: press Ctrl+Shift+G at Delphi IDE to generate GUID
['{5741A727-CADD-442C-B449-A9685085C223}']
function ZipToState(const ZipCode: string): string; stdcall;
procedure ZipToStateDetail(const ZipCode: string; out StateAbbrev: string;
out StateName: string; out ErrorText: string); stdcall;
end;
TWebZipCodeLookup = class(TWebActionNoSaveState, IWebZipCodeLookup)
function ZipToState(const ZipCode: string): string; stdcall;
procedure ZipToStateDetail(const ZipCode: string; out StateAbbrev: string;
out StateName: string; out ErrorText: string); stdcall;
end;
- The second example does publish the Execute method:
IWebZipCodeExecute = interface(IWebActionExecute)
['{3746C1DD-1700-4963-AE4B-A7E9489FC47D}']
function ZipToState(const ZipCode: string): string; stdcall;
procedure ZipToStateDetail(const ZipCode: string; out StateAbbrev: string;
out StateName: string; out ErrorText: string); stdcall;
end;
TWebZipCodeExecute = class(TWebZipCodeLookup, IWebZipCodeExecute)
private
procedure SendStateName;
public
procedure Execute; override;
end;
- Instantiate the webaction components as usual (using the "T" name, e.g. TWebZipCodeLookup)
- Implement each method, exactly as usual.
- Add the following to the Initialization of the unit:
initialization
RegisterIWebAction(TypeInfo(IWebZipCodeLookup));
RegisterIWebAction(TypeInfo(IWebZipCodeExecute));
end.
- If compiling with packages, add these packages: soaprtl;xmlrtl;inet;
- Compile and run the WebHub EXE as usual.