+ TStringBufferRemotable = reading a node's raw buffer

+ Better Delphi support : client & server( new )
    - SOAP, XMLRPC and BINARY formats

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@212 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2007-07-12 14:46:45 +00:00
parent d5bf30839b
commit 65f4a3dffd
84 changed files with 10759 additions and 7663 deletions

View File

@@ -34,10 +34,10 @@
-N"obj"
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-U"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-O"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-I"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-R"..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse"
-U"c:\program files\borland\delphi7\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\"
-O"c:\program files\borland\delphi7\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\"
-I"c:\program files\borland\delphi7\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\"
-R"c:\program files\borland\delphi7\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@@ -94,10 +94,10 @@ OutputDir=
UnitOutputDir=obj
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse
SearchPath=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\
Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;FIBDBMidas7;Jcl;JclVcl;JvCoreD7R;JvSystemD7R;JvStdCtrlsD7R;JvAppFrmD7R;JvBandsD7R;JvDBD7R;JvDlgsD7R;JvBDED7R;JvCmpD7R;JvCryptD7R;JvCtrlsD7R;JvCustomD7R;JvDockingD7R;JvDotNetCtrlsD7R;JvEDID7R;JvGlobusD7R;JvHMID7R;JvInterpreterD7R;JvJansD7R;JvManagedThreadsD7R;JvMMD7R;JvNetD7R;JvPageCompsD7R;JvPluginD7R;JvPrintPreviewD7R;JvRuntimeDesignD7R;JvTimeFrameworkD7R;JvUIBD7R;JvValidatorsD7R;JvWizardD7R;JvXPCtrlsD7R;dxForumLibD7;cxLibraryVCLD7;cxPageControlVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtItemsD7;dxBarExtDBItemsD7;dxsbD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxEdtrD7;EQTLD7;ECQDBCD7;EQDBTLD7;EQGridD7;dxGrEdD7;dxExELD7;dxELibD7;cxEditorsVCLD7;cxGridVCLD7;dxThemeD7;cxDataD7;cxGridUtilsVCLD7;dxPSCoreD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSTeeChartD7;dxPSDBTeeChartD7;dxPSdxDBTVLnkD7;dxPSdxOCLnkD7;dxPSdxDBOCLnkD7;dxPScxGridLnkD7;dxPSTLLnkD7;qrpt
Conditionals=
DebugSourceDirs=
DebugSourceDirs=C:\Programmes\lazarus\wst\trunk\
UsePackages=0
[Parameters]
RunParams=
@@ -146,11 +146,13 @@ C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSc
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath]
Count=4
Item0=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse
Item1=..\..\;..\..\..\
Item2=..\..\
Item3=..\
Count=6
Item0=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\
Item1=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse;..\..\..\..\
Item2=..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\synapse
Item3=..\..\;..\..\..\
Item4=..\..\
Item5=..\
[HistoryLists\hlUnitOutputDirectory]
Count=1
Item0=obj

View File

@@ -3,13 +3,24 @@ program user_client_console;
{$APPTYPE CONSOLE}
uses
Classes, SysUtils, TypInfo,
Classes,
SysUtils,
TypInfo, ActiveX,
user_service_intf_proxy,
synapse_tcp_protocol, synapse_http_protocol, library_protocol,
synapse_tcp_protocol,
synapse_http_protocol,
library_protocol,
binary_formatter,
user_service_intf;
base_soap_formatter, soap_formatter,
base_xmlrpc_formatter, xmlrpc_formatter,
user_service_intf,
wst_delphi_xml in '..\..\..\wst_delphi_xml.pas';
{$INCLUDE wst.inc}
type
TUser = TUser_Type;
TUserCategory = TUserCategory_Type;
var
UserServiceInst : UserService;
@@ -58,8 +69,9 @@ begin
end;
end;
procedure HandleAdd();
type TAddType = ( atAdd, atUpdate );
procedure HandleAdd(const AType :TAddType);
const CAPTIONS : array[TAddType] of string = ( 'Adding a user :', 'Updating a user :' );
function ReadItem(const APrompt : string; const ANonNull : Boolean):string ;
begin
Result := '';
@@ -74,7 +86,7 @@ var
buff : string;
begin
buff := '';
WriteLn('Adding a user :');
WriteLn(CAPTIONS[AType]);
try
usr := TUser.Create();
try
@@ -86,7 +98,10 @@ begin
usr.Category:= Normal;
usr.eMail := ReadItem('Enter user e-mail : ',False);
usr.Preferences := ReadItem('Enter user Preferences : ',False);
UserServiceInst.Add(usr);
if ( AType = atUpdate ) then
UserServiceInst.Update(usr)
else
UserServiceInst.Add(usr);
finally
FreeAndNil(usr);
end;
@@ -112,28 +127,46 @@ begin
end;
end;
type TTransportType = ( ttLibrary, ttTCP, ttHTTP );
procedure CreateProxy(const ATransportType :TTransportType);
const ADDRESS_MAP : array[TTransportType] of string = (
'LIB:FileName=..\..\library_server\lib_server.dll;target=UserService',
'TCP:Address=127.0.0.1;Port=1234;target=UserService',
//'http:Address=http://127.0.0.1:8080/wst/services/UserService'
'http:Address=http://127.0.0.1:8000/services/UserService'
);
procedure HandleDeleteUser();
var
buff : string;
begin
buff := ADDRESS_MAP[ATransportType];
if ( ATransportType = ttLibrary ) then
Write('Enter User Name : ');
ReadLn(buff);
UserServiceInst.Delete(buff);
end;
type
TTransportType = ( ttLibrary, ttTCP, ttHTTP );
TFormatType = ( ftBinary, ftSoap, ftXmlRPC );
var
TransportType : TTransportType;
FormatValue : TFormatType;
procedure CreateProxy();
const ADDRESS_MAP : array[TTransportType] of string = (
'LIB:FileName=..\library_server\lib_server.dll;target=UserService',
'TCP:Address=127.0.0.1;Port=1234;target=UserService',
//'http:Address=http://127.0.0.1:8080/wst/services/UserService/?format=soap'
'http:Address=http://127.0.0.1:8000/services/UserService'
);
FORMAT_MAP : array[TFormatType] of string = ( 'binary', 'soap', 'xmlrpc' );
var
buff : string;
begin
if ( TransportType = ttHTTP ) then
buff := Format('%s/?format=%s',[ADDRESS_MAP[TransportType],FORMAT_MAP[FormatValue]])
else
buff := ADDRESS_MAP[TransportType];
if ( TransportType = ttLibrary ) then
buff := StringReplace(buff,'\',PathDelim,[rfReplaceAll, rfIgnoreCase]);
UserServiceInst := TUserService_Proxy.Create(
'UserService',
'binary:',
FORMAT_MAP[FormatValue] + ':',
buff
);
end;
function ReadTransportType():TTransportType;
procedure ReadTransportType();
var
buff : string;
begin
@@ -149,9 +182,34 @@ begin
buff := UpperCase(Trim(buff));
if ( Length(buff) > 0 ) and ( buff[1] in ['L','T', 'H'] ) then begin
case buff[1] of
'L' : Result := ttLibrary;
'T' : Result := ttTCP;
'H' : Result := ttHTTP;
'L' : TransportType := ttLibrary;
'T' : TransportType := ttTCP;
'H' : TransportType := ttHTTP;
end;
Break;
end;
end;
end;
procedure ReadFormatType();
var
buff : string;
begin
WriteLn;
WriteLn('Select a messaging format : ');
WriteLn(' B : binary ( binary_formatter.pas )');
WriteLn(' S : soap ( soap_formatter.pas )');
WriteLn(' X : XmlRpc ( xmlrpc_formatter.pas )');
WriteLn;
Write('Your selection : ');
while True do begin
ReadLn(buff);
buff := UpperCase(Trim(buff));
if ( Length(buff) > 0 ) and ( buff[1] in ['B','S', 'X'] ) then begin
case buff[1] of
'B' : FormatValue := ftBinary;
'S' : FormatValue := ftSoap;
'X' : FormatValue := ftXmlRPC;
end;
Break;
end;
@@ -160,36 +218,56 @@ end;
var
strBuffer : string;
tt : TTransportType;
begin
SYNAPSE_RegisterTCP_Transport();
SYNAPSE_RegisterHTTP_Transport();
LIB_Register_Transport();
WriteLn('Sample Application using Web Services Toolkit');
CreateProxy(ReadTransportType());
WriteLn('Menu :');
WriteLn(' L : Show the user list');
WriteLn(' A : Add a new user');
WriteLn(' F : Find a new');
WriteLn(' C : Change the communication protocol');
WriteLn(' X : Exit');
WriteLn;
Write('Choose a item : ');
while True do begin
strBuffer := '';
ReadLn(strBuffer);
strBuffer := UpperCase(Trim(strBuffer));
if ( Length(strBuffer) > 0 ) then begin
case strBuffer[1] of
'L' : HandleShowAll();
'A' : HandleAdd();
'F' : HandleFindUser();
'C' : CreateProxy(ReadTransportType());
'X' : Break;
CoInitialize(nil);
try
SYNAPSE_RegisterTCP_Transport();
SYNAPSE_RegisterHTTP_Transport();
LIB_Register_Transport();
WriteLn('Sample Application using Web Services Toolkit');
ReadFormatType();
ReadTransportType();
CreateProxy();
WriteLn('Menu :');
WriteLn(' L : Show the user list');
WriteLn(' A : Add a new user');
WriteLn(' U : Update a user');
WriteLn(' D : Delete a user');
WriteLn(' F : Find a new');
WriteLn(' C : Change the communication protocol');
WriteLn(' Z : Change the messaging format');
WriteLn(' X : Exit');
WriteLn;
Write('Choose a item : ');
while True do begin
strBuffer := '';
ReadLn(strBuffer);
strBuffer := UpperCase(Trim(strBuffer));
if ( Length(strBuffer) > 0 ) then begin
case strBuffer[1] of
'L' : HandleShowAll();
'A' : HandleAdd(atAdd);
'U' : HandleAdd(atUpdate);
'D' : HandleDeleteUser();
'F' : HandleFindUser();
'C' :
begin
ReadTransportType();
CreateProxy();
end;
'Z' :
begin
ReadFormatType();
CreateProxy();
end;
'X' : Break;
end;
WriteLn;
Write('Choose a item : ');
end;
WriteLn;
Write('Choose a item : ');
end;
finally
CoUninitialize();
end;
end.