1,594
社区成员




unit OrlWebService;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
OrlServicePortType = interface(IInvokable)
['{76B1606E-9B05-4FE0-AD1E-55393C25E5BB}']
function GetPorts(const userName: WideString; const password: WideString): WideString; stdcall;
end;
function GetOrlServicePortType(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): OrlServicePortType;
implementation
function GetOrlServicePortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): OrlServicePortType;
const
defWSDL = 'http://192.168.1.27:8080/axis2/services/OrlService?wsdl';
defURL = 'http://192.168.1.27:8080/axis2/services/OrlService';
defSvc = 'OrlService';
defPrt = 'OrlServicePortType';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
begin
RIO := THTTPRIO.Create(nil);
end
else
RIO := HTTPRIO;
try
Result := (RIO as OrlServicePortType);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(OrlServicePortType), 'http://service.nineOrl.com', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(OrlServicePortType), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(OrlServicePortType), ioDocument);
end.