delphi教程

短信API delphi短信接口源代码示例

位置:首页 > delphi教程 > 高级教程,2015-10-15
delphi短信接口源代码 免费下载 (支持回复、长短信、固定短信平台号) [Delphi/Pascal]代码代码中g_Submit函数第1个参数填用户名第2个

delphi短信接口源代码 免费下载 (支持回复、长短信、固定短信平台号) 

[Delphi/Pascal]代码

代码中g_Submit函数
第1个参数填用户名
第2个参数是密码
第3个置空
第4个参数是产品代码
第5个要发送的的手机号码
第6个是信息内容
Unit2.GetMyWebServericeSoap(false,'http://www.xxxx.com/service.asmx').g_Submit('','','','802','13426107503','test');

[Delphi/Pascal]代码w

unit Unit2;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type
MyWebServericeSoap = interface(IInvokable)
    ['{5BA22C24-B55B-44D5-63A4-623BCC4101FC}']
    function  g_Submit(const sname: WideString; const spwd: WideString; const scorpid: WideString; const sprdid: WideString; const sdst: WideString; const smsg: WideString): WideString; stdcall;

  end;

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

implementation

function GetMyWebServericeSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): MyWebServericeSoap;
const
  defWSDL = 'http://www.xxxx.com/service.asmx?wsdl';
  defURL  = 'http://www.xxxx.com/service.asmx';
  defSvc  = 'Unit2';
  defPrt  = 'MyWebServericeSoap';
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 MyWebServericeSoap);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
    //
    RIO.HTTPWebNode.UseUTF8InHeader:=True;
    //
  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.

[Delphi/Pascal]代码

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: 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);
begin
Memo1.Text:=Unit2.GetMyWebServericeSoap(false,'http://www.xxxx.com/service.asmx').g_Submit('','','','802','13426107503','test');
end;

end.

TAGS:delphi短信接口

猜你喜欢

NewHot