Home > Back-end >  Delphi code sample - S05GK interface to send SMS
Delphi code sample - S05GK interface to send SMS

Time:09-26

Delphi SMS interface development can make use of the Delphi SOAPHTTPClient, HTTPRIO etc to realize the text submitted, the following code excerpt from moving velocity (sudas. Cn) provided by the sample program, only gather the Unit1. Pas file source and Unit2 pas document source,



Unit1. Pas file source:

The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Unit2;

Type
TForm1=class (TForm)
For: TButton;
Memo1: TMemo;
Procedure Button1Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
The begin
Memo1. Text:=Unit2. GetMyWebServericeSoap (false, 'http://sdk.sudas.cn/submitdata/service.asmx'). The g_Submit (', ' ' ' ', '802', '13426107503', 'test');
end;

End.


Unit2. Pas file source:

The unit Unit2.

Interface

USES InvokeRegistry SOAPHTTPClient, Types, XSBuiltIns;

Type
MyWebServericeSoap=interface (IInvokable)
[' {5 ba22c24 - d5 B55B - 44-63 a4-623 bcc4101fc} ']
The function g_Submit (const sname: WideString; Const SPWD: WideString; Const scorpid: WideString; Const sprdid: WideString; Const SDST: WideString; Const SMSG: WideString) : WideString; Stdcall;

end;

The function GetMyWebServericeSoap (UseWSDL: Boolean=System. False. Addr: string='; HTTPRIO: THTTPRIO=nil) : MyWebServericeSoap;

Implementation

The function GetMyWebServericeSoap (UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO) : MyWebServericeSoap;
Const
DefWSDL='http://sdk.sudas.cn/submitdata/service.asmx? WSDL ';
DefURL='http://sdk.sudas.cn/submitdata/service.asmx'.
Unit2 defSvc=' ';
DefPrt='MyWebServericeSoap';
Var
RIO: THTTPRIO;
The begin
Result:=nil;
If (Addr=' ') then
The begin
If UseWSDL then
Addr:=defWSDL
The else
Addr:=defURL;
end;
If HTTPRIO=nil then
RIO:=THTTPRIO. Create (nil)
The else
RIO:=HTTPRIO;
Try
Result:=(RIO as MyWebServericeSoap);
If UseWSDL then
The begin
RIO. WSDLLocation:=Addr;
RIO. Service:=defSvc;
RIO. Port:=defPrt;
End the else
LTD URL:=Addr;
//
LTD HTTPWebNode. UseUTF8InHeader:=True;
//
The finally
If (Result=nil) and (HTTPRIO=nil) then
RIO. Free;
end;
end;

Initialization
InvRegistry. RegisterInterface (TypeInfo (MyWebServericeSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry. RegisterDefaultSOAPAction (TypeInfo (MyWebServericeSoap), 'http://tempuri.org/%operationName%');
InvRegistry. RegisterInvokeOptions (TypeInfo (MyWebServericeSoap), ioDocument);
End.



G_Submit functions in your code, the first parameter to fill the user name, the second parameter is the password, the third empty, the fourth parameter is the product code, the fifth to send phone number, number six is information content
Unit2. GetMyWebServericeSoap (false, 'http://sdk.sudas.cn/submitdata/service.asmx'). The g_Submit (', ' ' ' ', '802', '13426107503', 'test');

Above is the reference velocity of mobile SMS submit interface, specific address and need to fill in the content of the submitted, please contact your service provider,
  • Related