L
liudongjie
Unregistered / Unconfirmed
GUEST, unregistred user!
在www.corba.com.cn上斑竹实现了一个corba服务器,并提供ior字符串,有基于java和
borland C ++得例程利用ior字符串连接远程的corba 服务器,请教各位用过delphi 6开发
corba应用程序的高手,怎样用delphi开发实现客户端连接corba服务器,我用idl2pas,不知道
各个函数的得用法,实际上是菜鸟,并不理解idl2pas的实质,请高手能做一个例子让在下
模仿一下,或者看看我的程序有什么错误,运行总是提示内存错误
unit UMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Corba, StdCtrls, corbacounter_c, corbacounter_i, Psock, NMHttp, ShellApi;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Button2: TButton;
Label4: TLabel;
NMHTTP1: TNMHTTP;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
protected
{ protected declarations }
corbaCounter : CounterInterface;
procedure InitCorba;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.InitCorba;
begin
CorbaInitialize;
//corbaCounter := TCounterInterfaceHelper.Bind;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
//_orb : TORB;
i: Integer;
_counterObject: CORBAObject;
ior: String;
begin
i := 0;
{NMHTTP1.TimeOut := 10000;
NMHTTP1.InputFileMode := False;
NMHTTP1.OutputFileMode := False;
NMHTTP1.ReportLevel := Status_Basic;
NMHTTP1.Get('www.corba.com.cn/ior');
}
ior := 'IOR:000000000000002649444c3a636f726261636f756e7465722f436f756e7465724';
ior := ior + '96e746572666163653a312e3000000000000003000000000000003b00010000';
ior := ior + '000000103230322e3131322e3130302e32353200800100000000001b5374616';
ior := ior + 'e64617264496d706c4e616d652f001036413704304c350d0000000000000000';
ior := ior + '4000010100000000103230322e3131322e3130302e323532008001000000000';
ior := ior + '01b5374616e64617264496d706c4e616d652f001036413704304c350d000000';
ior := ior + '0000000000010000002c0000000000000001000000010000001c00000000000';
ior := ior + '100010000000105010001000101090000000105010001';
InitCorba;
Corba.ORB.Init;
Corba.BOA.Initialize;
//_counterObject := corba.ORB.StringToObject(NMHTTP1.Body);
_counterObject := corba.ORB.StringToObject(ior);
corbaCounter := TCounterInterfaceHelper.Narrow(_counterObject);
//Edit3.Text := NMHTTP1.Body;
Edit3.Text := corbaCounter.CounterFunc(Edit1.Text, i);
Edit2.Text := IntToStr(i);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute(Application.Handle,'open','http://www.corba.com.cn/jsp/corbacounter.jsp',
'','',SW_SHOW);
end;
end.
borland C ++得例程利用ior字符串连接远程的corba 服务器,请教各位用过delphi 6开发
corba应用程序的高手,怎样用delphi开发实现客户端连接corba服务器,我用idl2pas,不知道
各个函数的得用法,实际上是菜鸟,并不理解idl2pas的实质,请高手能做一个例子让在下
模仿一下,或者看看我的程序有什么错误,运行总是提示内存错误
unit UMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Corba, StdCtrls, corbacounter_c, corbacounter_i, Psock, NMHttp, ShellApi;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Button2: TButton;
Label4: TLabel;
NMHTTP1: TNMHTTP;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ private declarations }
protected
{ protected declarations }
corbaCounter : CounterInterface;
procedure InitCorba;
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.InitCorba;
begin
CorbaInitialize;
//corbaCounter := TCounterInterfaceHelper.Bind;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
//_orb : TORB;
i: Integer;
_counterObject: CORBAObject;
ior: String;
begin
i := 0;
{NMHTTP1.TimeOut := 10000;
NMHTTP1.InputFileMode := False;
NMHTTP1.OutputFileMode := False;
NMHTTP1.ReportLevel := Status_Basic;
NMHTTP1.Get('www.corba.com.cn/ior');
}
ior := 'IOR:000000000000002649444c3a636f726261636f756e7465722f436f756e7465724';
ior := ior + '96e746572666163653a312e3000000000000003000000000000003b00010000';
ior := ior + '000000103230322e3131322e3130302e32353200800100000000001b5374616';
ior := ior + 'e64617264496d706c4e616d652f001036413704304c350d0000000000000000';
ior := ior + '4000010100000000103230322e3131322e3130302e323532008001000000000';
ior := ior + '01b5374616e64617264496d706c4e616d652f001036413704304c350d000000';
ior := ior + '0000000000010000002c0000000000000001000000010000001c00000000000';
ior := ior + '100010000000105010001000101090000000105010001';
InitCorba;
Corba.ORB.Init;
Corba.BOA.Initialize;
//_counterObject := corba.ORB.StringToObject(NMHTTP1.Body);
_counterObject := corba.ORB.StringToObject(ior);
corbaCounter := TCounterInterfaceHelper.Narrow(_counterObject);
//Edit3.Text := NMHTTP1.Body;
Edit3.Text := corbaCounter.CounterFunc(Edit1.Text, i);
Edit2.Text := IntToStr(i);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute(Application.Handle,'open','http://www.corba.com.cn/jsp/corbacounter.jsp',
'','',SW_SHOW);
end;
end.