123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- unit Service;
- interface
- uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
- type
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Service1Soap = interface(IInvokable)
- ['{CFE467D4-A39E-2BD2-5836-7685A9E27F8D}']
- function GetUserInfo(const uid: WideString; const pwd: WideString): WideString; stdcall;
- function EditUserPwd(const uid: WideString; const pwd: WideString; const newpwd: WideString): WideString; stdcall;
- function SendMessages(const uid: WideString; const pwd: WideString; const tos: WideString; const msg: WideString; const otime: WideString): WideString; stdcall;
- function SendFax(const uid: WideString; const pwd: WideString; const faxno: WideString; const men: WideString; const title: WideString; const Bytes: TByteDynArray; const FileName: WideString): WideString; stdcall;
- function SendVoice(const uid: WideString; const pwd: WideString; const vto: WideString; const vtxt: WideString; const mode: WideString; const FileBytes: TByteDynArray; const svrno: WideString; const str_time: WideString; const end_time: WideString): WideString; stdcall;
- end;
- function GetService1Soap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): Service1Soap;
- implementation
- function GetService1Soap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): Service1Soap;
- const
- defWSDL = 'http://service2.winic.org/Service.asmx?WSDL';
- defURL = 'http://service2.winic.org/Service.asmx';
- defSvc = 'Service1';
- defPrt = 'Service1Soap';
- var
- RIO: THTTPRIO;
- begin
- Result := nil;
- if (Addr = '') then
- begin
- if UseWSDL then
- Addr := defWSDL
- else
- Addr := defURL;
- end;
- if HTTPRIO = nil then
- RIO := THTTPRIO.Create(nil)
- else
- RIO := HTTPRIO;
- try
- Result := (RIO as Service1Soap);
- 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(Service1Soap), 'http://tempuri.org/', 'utf-8');
- InvRegistry.RegisterDefaultSOAPAction(TypeInfo(Service1Soap), 'http://tempuri.org/%operationName%');
-
- InvRegistry.RegisterInvokeOptions(TypeInfo(Service1Soap), ioDocument);
- end.
|