You've already forked lazarus-ccr
Object Pascal "record" serialization ( first commit! )
TTest_TIntfPoolItem TTest_TSimpleItemFactory TTest_XmlRpcFormatterExceptionBlock TTest_SoapFormatterExceptionBlock Record serialization test git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@243 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
222
wst/trunk/tests/record/client/record_client.lpi
Normal file
222
wst/trunk/tests/record/client/record_client.lpi
Normal file
@@ -0,0 +1,222 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="16">
|
||||
<Unit0>
|
||||
<Filename Value="record_client.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="record_client"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="35"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="..\record_sample.pas"/>
|
||||
<UnitName Value="record_sample"/>
|
||||
<CursorPos X="53" Y="16"/>
|
||||
<TopLine Value="13"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\record_sample_proxy.pas"/>
|
||||
<UnitName Value="record_sample_proxy"/>
|
||||
<CursorPos X="1" Y="56"/>
|
||||
<TopLine Value="41"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\record_sample.wst"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="9"/>
|
||||
<SyntaxHighlighter Value="None"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\synapse_http_protocol.pas"/>
|
||||
<UnitName Value="synapse_http_protocol"/>
|
||||
<CursorPos X="1" Y="16"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\..\record_rtti.pas"/>
|
||||
<UnitName Value="record_rtti"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\base_service_intf.pas"/>
|
||||
<UnitName Value="base_service_intf"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\..\wst_types.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wst_types"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="35"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\..\..\base_soap_formatter.pas"/>
|
||||
<UnitName Value="base_soap_formatter"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="..\..\..\soap_formatter.pas"/>
|
||||
<UnitName Value="soap_formatter"/>
|
||||
<CursorPos X="1" Y="188"/>
|
||||
<TopLine Value="173"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\..\..\imp_utils.pas"/>
|
||||
<UnitName Value="imp_utils"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="18"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="..\..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\classes\classesh.inc"/>
|
||||
<CursorPos X="15" Y="513"/>
|
||||
<TopLine Value="498"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\classes\stringl.inc"/>
|
||||
<CursorPos X="54" Y="230"/>
|
||||
<TopLine Value="222"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\strutils.pp"/>
|
||||
<UnitName Value="strutils"/>
|
||||
<CursorPos X="21" Y="32"/>
|
||||
<TopLine Value="163"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="..\..\..\service_intf.pas"/>
|
||||
<UnitName Value="service_intf"/>
|
||||
<CursorPos X="1" Y="220"/>
|
||||
<TopLine Value="205"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\..\..\indy_http_protocol.pas"/>
|
||||
<UnitName Value="indy_http_protocol"/>
|
||||
<CursorPos X="15" Y="35"/>
|
||||
<TopLine Value="20"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit15>
|
||||
</Units>
|
||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="..\..\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Inc\"/>
|
||||
<OtherUnitFiles Value="..\;..\..\;..\..\..\;$(LazarusDir)\others_package\synapse\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Core\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Protocols\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\System\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Inc\"/>
|
||||
<UnitOutputDirectory Value="obj"/>
|
||||
<SrcPath Value="$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Core\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Protocols\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\System\;$(LazarusDir)\others_package\indy\indy-10.2.0.1\fpc\Inc\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<BreakPoints Count="6">
|
||||
<Item1>
|
||||
<Source Value="..\..\..\metadata_wsdl.pas"/>
|
||||
<Line Value="459"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Source Value="..\..\..\metadata_wsdl.pas"/>
|
||||
<Line Value="468"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Source Value="..\..\..\metadata_wsdl.pas"/>
|
||||
<Line Value="431"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Source Value="..\..\..\server_service_intf.pas"/>
|
||||
<Line Value="630"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Source Value="..\..\..\base_service_intf.pas"/>
|
||||
<Line Value="4634"/>
|
||||
</Item5>
|
||||
<Item6>
|
||||
<Source Value="..\..\..\base_service_intf.pas"/>
|
||||
<Line Value="4711"/>
|
||||
</Item6>
|
||||
</BreakPoints>
|
||||
<Exceptions Count="2">
|
||||
<Item1>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item2>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
110
wst/trunk/tests/record/client/record_client.pas
Normal file
110
wst/trunk/tests/record/client/record_client.pas
Normal file
@@ -0,0 +1,110 @@
|
||||
program record_client;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, {$IFDEF WINDOWS}ActiveX,{$ENDIF}
|
||||
soap_formatter,
|
||||
synapse_http_protocol,
|
||||
//indy_http_protocol,
|
||||
metadata_repository,
|
||||
record_sample, record_sample_proxy;
|
||||
|
||||
function ReadEntryStr(const APromp : string):string ;
|
||||
begin
|
||||
Result := '';
|
||||
Write(APromp);
|
||||
while True do begin
|
||||
ReadLn(Result);
|
||||
Result := Trim(Result);
|
||||
if ( Length(Result) > 0 ) then
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ReadEntryInt(const APromp : string):Integer ;
|
||||
var
|
||||
locBuffer : string;
|
||||
begin
|
||||
Write(APromp);
|
||||
while True do begin
|
||||
ReadLn(locBuffer);
|
||||
locBuffer := Trim(locBuffer);
|
||||
if TryStrToInt(locBuffer,Result) then
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ReadEntryFloat(const APromp : string) : Single ;
|
||||
var
|
||||
locBuffer : string;
|
||||
begin
|
||||
Write(APromp);
|
||||
while True do begin
|
||||
ReadLn(locBuffer);
|
||||
locBuffer := Trim(locBuffer);
|
||||
if TryStrToFloat(locBuffer,Result) then
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
var
|
||||
locService : RecordService;
|
||||
A : RecordA;
|
||||
B : RecordB;
|
||||
C : RecordC;
|
||||
begin
|
||||
{$IFDEF WINDOWS}
|
||||
CoInitialize(nil);
|
||||
try
|
||||
{$ENDIF}
|
||||
SYNAPSE_RegisterHTTP_Transport();
|
||||
//INDY_RegisterHTTP_Transport();
|
||||
WriteLn('Web Services Toolkit Record sample');
|
||||
WriteLn('This sample demonstrates the Object Pascal "Record" support by WST');
|
||||
WriteLn();
|
||||
locService := TRecordService_Proxy.Create(
|
||||
'RecordService','soap:Style=RPC;EncodingStyle=Literal','http:address=http://127.0.0.1:20000/services/RecordService');
|
||||
while True do begin
|
||||
A.fieldA := 0;
|
||||
A.fieldB := 0;
|
||||
C.intField := 1;
|
||||
C.RecordField.RecordField.fieldA := 21;
|
||||
C.RecordField.RecordField.fieldB := 22;
|
||||
C.RecordField.RecordField.comment := 'Comment 23';
|
||||
C.RecordField.intField := 3;
|
||||
C.RecordField.RecordField.comment := '31 comment';
|
||||
C.RecordField.comment := 'xx comment ddf';
|
||||
A.fieldA := ReadEntryInt('Enter the Integer field : ');
|
||||
A.fieldB := ReadEntryFloat('Enter the Single field : ');
|
||||
B.intField := 2 * A.fieldA;
|
||||
B := locService.Add(A);
|
||||
WriteLn;
|
||||
WriteLn('Response ( B ) : ');
|
||||
WriteLn(' intField : ',B.intField);
|
||||
WriteLn(' singleField : ',B.singleField);
|
||||
WriteLn(' comment : ',B.comment);
|
||||
WriteLn();
|
||||
WriteLn;
|
||||
C := locService.AddRec(A,B,C);
|
||||
WriteLn;
|
||||
WriteLn('Response ( C ) : ');
|
||||
WriteLn(' intField : ',C.intField);
|
||||
WriteLn(' RecordField.intField : ',C.RecordField.intField);
|
||||
WriteLn(' RecordField.singleField : ',C.RecordField.singleField);
|
||||
WriteLn(' RecordField.singleField : ',C.RecordField.comment);
|
||||
WriteLn(' RecordField.RecordField.fieldA : ',C.RecordField.RecordField.fieldA);
|
||||
WriteLn(' RecordField.RecordField.fieldB : ',C.RecordField.RecordField.fieldB);
|
||||
WriteLn(' RecordField.RecordField.comment : ',C.RecordField.RecordField.comment);
|
||||
WriteLn();
|
||||
|
||||
if ( UpperCase(ReadEntryStr('Continue ( Y/N ) :'))[1] <> 'Y' ) then
|
||||
Break;
|
||||
end;
|
||||
{$IFDEF WINDOWS}
|
||||
finally
|
||||
CoUninitialize();
|
||||
end;
|
||||
{$ENDIF}
|
||||
end.
|
||||
|
Reference in New Issue
Block a user