bugs fixs

Amazon sample runs well

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@148 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2007-04-22 23:05:25 +00:00
parent 04b3d1fb7a
commit 558fbb5c86
10 changed files with 769 additions and 278 deletions

View File

@ -1786,8 +1786,8 @@ begin
end else begin
itmName := AName;
end;
len := AStore.BeginArrayRead(AName,ATypeInfo, GetStyle(),itmName);
if ( len > 0 ) then begin
len := AStore.BeginArrayRead(AName,ATypeInfo,styl,itmName);
if ( len >= 0 ) then begin
Try
If Not Assigned(AObject) Then
AObject := Create();
@ -2313,19 +2313,21 @@ begin
itmName := AName;
end;
len := AStore.BeginArrayRead(AName,ATypeInfo, GetStyle(),itmName);
try
if not Assigned(AObject) then
AObject := Create();
nativObj := nil;
nativObj := AObject as TBaseSimpleTypeArrayRemotable;
if ( len > 0 ) then begin
nativObj.SetLength(len);
for i := 0 to Pred(len) do begin
nativObj.LoadItem(AStore,i);
if ( len >= 0 ) then begin
try
if not Assigned(AObject) then
AObject := Create();
nativObj := nil;
nativObj := AObject as TBaseSimpleTypeArrayRemotable;
if ( len >= 0 ) then begin
nativObj.SetLength(len);
for i := 0 to Pred(len) do begin
nativObj.LoadItem(AStore,i);
end;
end;
finally
AStore.EndScopeRead();
end;
finally
AStore.EndScopeRead();
end;
end;
@ -3416,141 +3418,142 @@ Var
tr : TTypeRegistry;
begin
oldSS := AStore.GetSerializationStyle();
AStore.BeginObjectRead(AName,ATypeInfo);
try
if AStore.IsCurrentScopeNil() then
Exit; // ???? FreeAndNil(AObject);
If Not Assigned(AObject) Then
AObject := Create();
LoadValue(AObject,AStore);
objTypeData := GetTypeData(ATypeInfo);
propCount := objTypeData^.PropCount;
If ( propCount > 0 ) Then Begin
propListLen := GetPropList(ATypeInfo,propList);
Try
tr := GetTypeRegistry();
AStore.SetSerializationStyle(ssAttibuteSerialization);
For i := 0 To Pred(propCount) Do Begin
p := propList^[i];
persistType := IsStoredPropClass(objTypeData^.ClassType,p);
If ( persistType in [pstOptional,pstAlways] ) Then Begin
pt := p^.PropType;
propName := tr.ItemByTypeInfo[pt].GetExternalPropertyName(p^.Name);
try
Case pt^.Kind Of
tkInt64,tkQWord :
Begin
AStore.Get(pt,propName,int64Data);
SetOrdProp(AObject,p^.Name,int64Data);
End;
tkLString, tkAString :
Begin
AStore.Get(pt,propName,strData);
SetStrProp(AObject,p^.Name,strData);
End;
tkBool :
Begin
AStore.Get(pt,propName,boolData);
SetOrdProp(AObject,p^.Name,Ord(boolData));
End;
tkClass :
Begin
objData := GetObjectProp(AObject,p^.Name);
objDataCreateHere := not Assigned(objData);
try
AStore.Get(pt,propName,objData);
if objDataCreateHere then
SetObjectProp(AObject,p^.Name,objData);
finally
if objDataCreateHere then
FreeAndNil(objData);
end;
End;
tkEnumeration,tkInteger :
Begin
FillChar(enumData,SizeOf(enumData),#0);
Case GetTypeData(p^.PropType)^.OrdType Of
otSByte :
Begin
AStore.Get(pt,propName,enumData.ShortIntData);
int64Data := enumData.ShortIntData;
End;
otUByte :
Begin
AStore.Get(pt,propName,enumData.ByteData);
int64Data := enumData.ByteData;
End;
otSWord :
Begin
AStore.Get(pt,propName,enumData.SmallIntData);
int64Data := enumData.SmallIntData;
End;
otUWord :
Begin
AStore.Get(pt,propName,enumData.WordData);
int64Data := enumData.WordData;
End;
otSLong:
Begin
AStore.Get(pt,propName,enumData.SLongIntData);
int64Data := enumData.SLongIntData;
End;
otULong :
Begin
AStore.Get(pt,propName,enumData.ULongIntData);
int64Data := enumData.ULongIntData;
End;
if ( AStore.BeginObjectRead(AName,ATypeInfo) >= 0 ) then begin
try
if AStore.IsCurrentScopeNil() then
Exit; // ???? FreeAndNil(AObject);
If Not Assigned(AObject) Then
AObject := Create();
LoadValue(AObject,AStore);
objTypeData := GetTypeData(ATypeInfo);
propCount := objTypeData^.PropCount;
If ( propCount > 0 ) Then Begin
propListLen := GetPropList(ATypeInfo,propList);
Try
tr := GetTypeRegistry();
AStore.SetSerializationStyle(ssAttibuteSerialization);
For i := 0 To Pred(propCount) Do Begin
p := propList^[i];
persistType := IsStoredPropClass(objTypeData^.ClassType,p);
If ( persistType in [pstOptional,pstAlways] ) Then Begin
pt := p^.PropType;
propName := tr.ItemByTypeInfo[pt].GetExternalPropertyName(p^.Name);
try
Case pt^.Kind Of
tkInt64,tkQWord :
Begin
AStore.Get(pt,propName,int64Data);
SetOrdProp(AObject,p^.Name,int64Data);
End;
SetOrdProp(AObject,p^.Name,int64Data);
End;
tkFloat :
Begin
FillChar(floatDt,SizeOf(floatBuffer),#0);
Case GetTypeData(p^.PropType)^.FloatType Of
ftSingle :
Begin
AStore.Get(pt,propName,floatBuffer.SingleData);
floatDt := floatBuffer.SingleData;
End;
ftDouble :
Begin
AStore.Get(pt,propName,floatBuffer.DoubleData);
floatDt := floatBuffer.DoubleData;
End;
ftExtended :
Begin
AStore.Get(pt,propName,floatBuffer.ExtendedData);
floatDt := floatBuffer.ExtendedData;
End;
ftCurr :
Begin
AStore.Get(pt,propName,floatBuffer.CurrencyData);
floatDt := floatBuffer.CurrencyData;
End;
ftComp :
Begin
AStore.Get(pt,propName,floatBuffer.CompData);
floatDt := floatBuffer.CompData;
End;
tkLString, tkAString :
Begin
AStore.Get(pt,propName,strData);
SetStrProp(AObject,p^.Name,strData);
End;
SetFloatProp(AObject,p^.Name,floatDt);
End;
End;
except
on E : EServiceException do begin
if ( persistType = pstAlways ) then
raise;
tkBool :
Begin
AStore.Get(pt,propName,boolData);
SetOrdProp(AObject,p^.Name,Ord(boolData));
End;
tkClass :
Begin
objData := GetObjectProp(AObject,p^.Name);
objDataCreateHere := not Assigned(objData);
try
AStore.Get(pt,propName,objData);
if objDataCreateHere then
SetObjectProp(AObject,p^.Name,objData);
finally
if objDataCreateHere then
FreeAndNil(objData);
end;
End;
tkEnumeration,tkInteger :
Begin
FillChar(enumData,SizeOf(enumData),#0);
Case GetTypeData(p^.PropType)^.OrdType Of
otSByte :
Begin
AStore.Get(pt,propName,enumData.ShortIntData);
int64Data := enumData.ShortIntData;
End;
otUByte :
Begin
AStore.Get(pt,propName,enumData.ByteData);
int64Data := enumData.ByteData;
End;
otSWord :
Begin
AStore.Get(pt,propName,enumData.SmallIntData);
int64Data := enumData.SmallIntData;
End;
otUWord :
Begin
AStore.Get(pt,propName,enumData.WordData);
int64Data := enumData.WordData;
End;
otSLong:
Begin
AStore.Get(pt,propName,enumData.SLongIntData);
int64Data := enumData.SLongIntData;
End;
otULong :
Begin
AStore.Get(pt,propName,enumData.ULongIntData);
int64Data := enumData.ULongIntData;
End;
End;
SetOrdProp(AObject,p^.Name,int64Data);
End;
tkFloat :
Begin
FillChar(floatDt,SizeOf(floatBuffer),#0);
Case GetTypeData(p^.PropType)^.FloatType Of
ftSingle :
Begin
AStore.Get(pt,propName,floatBuffer.SingleData);
floatDt := floatBuffer.SingleData;
End;
ftDouble :
Begin
AStore.Get(pt,propName,floatBuffer.DoubleData);
floatDt := floatBuffer.DoubleData;
End;
ftExtended :
Begin
AStore.Get(pt,propName,floatBuffer.ExtendedData);
floatDt := floatBuffer.ExtendedData;
End;
ftCurr :
Begin
AStore.Get(pt,propName,floatBuffer.CurrencyData);
floatDt := floatBuffer.CurrencyData;
End;
ftComp :
Begin
AStore.Get(pt,propName,floatBuffer.CompData);
floatDt := floatBuffer.CompData;
End;
End;
SetFloatProp(AObject,p^.Name,floatDt);
End;
End;
except
on E : EServiceException do begin
if ( persistType = pstAlways ) then
raise;
end;
end;
end;
End;
End;
Finally
Freemem(propList,propListLen*SizeOf(Pointer));
End;
Finally
Freemem(propList,propListLen*SizeOf(Pointer));
End;
End;
finally
AStore.EndScopeRead();
AStore.SetSerializationStyle(oldSS);
finally
AStore.EndScopeRead();
AStore.SetSerializationStyle(oldSS);
end;
end;
end;
@ -3866,13 +3869,14 @@ class procedure TBaseDateRemotable.Load(
var
strBuffer : string;
begin
AStore.BeginObjectRead(AName,ATypeInfo);
try
strBuffer := '';
AStore.GetScopeInnerValue(TypeInfo(string),strBuffer);
(AObject as TDateRemotable).AsDate := ParseDate(strBuffer);
finally
AStore.EndScopeRead();
if ( AStore.BeginObjectRead(AName,ATypeInfo) >= 0 ) then begin
try
strBuffer := '';
AStore.GetScopeInnerValue(TypeInfo(string),strBuffer);
(AObject as TDateRemotable).AsDate := ParseDate(strBuffer);
finally
AStore.EndScopeRead();
end;
end;
end;

View File

@ -439,7 +439,7 @@ function TAbstractArrayStackItem.FindNode(var ANodeName: string): TDOMNode;
begin
EnsureListCreated();
if ( FIndex >= FItemList.Count ) then
raise ESOAPException.CreateFmt('Index out of bound : %d; Node Name = "%s"',[FIndex,ANodeName]);
raise ESOAPException.CreateFmt('Index out of bound : %d; Node Name = "%s"; Parent Node = "%s"',[FIndex,ANodeName,ScopeObject.NodeName]);
Result:= FItemList.Item[FIndex];
Inc(FIndex);
ANodeName := Result.NodeName;

View File

@ -13,7 +13,7 @@
unit synapse_http_protocol;
{$mode objfpc}{$H+}
{$DEFINE WST_DBG}
//{$DEFINE WST_DBG}
interface

View File

@ -0,0 +1,310 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<General>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="6"/>
</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>
<RequiredPackages Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="21">
<Unit0>
<Filename Value="amazon.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="amazon"/>
<CursorPos X="1" Y="17"/>
<TopLine Value="1"/>
<UsageCount Value="82"/>
</Unit0>
<Unit1>
<Filename Value="umain.pas"/>
<ComponentName Value="fMain"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="umain.lrs"/>
<UnitName Value="umain"/>
<CursorPos X="22" Y="67"/>
<TopLine Value="58"/>
<EditorIndex Value="0"/>
<UsageCount Value="82"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="..\files\free\AWSECommerceService.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="AWSECommerceService"/>
<CursorPos X="36" Y="19399"/>
<TopLine Value="19328"/>
<EditorIndex Value="6"/>
<UsageCount Value="82"/>
<Bookmarks Count="2">
<Item0 X="5" Y="3387" ID="1"/>
<Item1 X="12" Y="2429" ID="2"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit2>
<Unit3>
<Filename Value="..\..\base_service_intf.pas"/>
<UnitName Value="base_service_intf"/>
<CursorPos X="31" Y="2315"/>
<TopLine Value="2305"/>
<EditorIndex Value="5"/>
<UsageCount Value="36"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\..\service_intf.pas"/>
<UnitName Value="service_intf"/>
<CursorPos X="1" Y="567"/>
<TopLine Value="527"/>
<EditorIndex Value="1"/>
<UsageCount Value="33"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
<Filename Value="..\..\metadata_repository.pas"/>
<UnitName Value="metadata_repository"/>
<CursorPos X="24" Y="410"/>
<TopLine Value="394"/>
<UsageCount Value="8"/>
</Unit5>
<Unit6>
<Filename Value="..\..\wst_resources_imp.pas"/>
<UnitName Value="wst_resources_imp"/>
<CursorPos X="3" Y="182"/>
<TopLine Value="183"/>
<UsageCount Value="7"/>
</Unit6>
<Unit7>
<Filename Value="..\files\free\AWSECommerceService_proxy.pas"/>
<UnitName Value="AWSECommerceService_proxy"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="2"/>
<UsageCount Value="31"/>
<Loaded Value="True"/>
</Unit7>
<Unit8>
<Filename Value="..\..\soap_formatter.pas"/>
<UnitName Value="soap_formatter"/>
<CursorPos X="1" Y="263"/>
<TopLine Value="221"/>
<EditorIndex Value="3"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
<Filename Value="..\..\synapse_http_protocol.pas"/>
<UnitName Value="synapse_http_protocol"/>
<CursorPos X="3" Y="16"/>
<TopLine Value="1"/>
<UsageCount Value="14"/>
</Unit9>
<Unit10>
<Filename Value="..\..\imp_utils.pas"/>
<UnitName Value="imp_utils"/>
<CursorPos X="1" Y="86"/>
<TopLine Value="73"/>
<UsageCount Value="29"/>
</Unit10>
<Unit11>
<Filename Value="..\..\base_soap_formatter.pas"/>
<UnitName Value="base_soap_formatter"/>
<CursorPos X="3" Y="1137"/>
<TopLine Value="1162"/>
<EditorIndex Value="4"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\objpas\typinfo.pp"/>
<UnitName Value="typinfo"/>
<CursorPos X="3" Y="925"/>
<TopLine Value="921"/>
<UsageCount Value="8"/>
</Unit12>
<Unit13>
<Filename Value="..\..\ics_http_protocol.pas"/>
<UnitName Value="ics_http_protocol"/>
<CursorPos X="1" Y="183"/>
<TopLine Value="161"/>
<UsageCount Value="15"/>
</Unit13>
<Unit14>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\xml\dom.pp"/>
<UnitName Value="DOM"/>
<CursorPos X="15" Y="269"/>
<TopLine Value="256"/>
<UsageCount Value="8"/>
</Unit14>
<Unit15>
<Filename Value="..\..\..\..\..\lazarusClean\others_package\ics\latest_distr\Delphi\Vc32\HttpProt.pas"/>
<UnitName Value="HttpProt"/>
<CursorPos X="1" Y="2555"/>
<TopLine Value="2544"/>
<UsageCount Value="8"/>
</Unit15>
<Unit16>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\objpas\sysutils\sysstrh.inc"/>
<CursorPos X="10" Y="112"/>
<TopLine Value="91"/>
<UsageCount Value="9"/>
</Unit16>
<Unit17>
<Filename Value="..\..\..\..\..\lazarus211\fpc\2.1.1\source\packages\fcl-xml\src\dom.pp"/>
<UnitName Value="DOM"/>
<CursorPos X="17" Y="302"/>
<TopLine Value="289"/>
<UsageCount Value="10"/>
</Unit17>
<Unit18>
<Filename Value="..\..\..\..\..\lazarus211\fpc\2.1.1\source\rtl\i386\i386.inc"/>
<CursorPos X="2" Y="1284"/>
<TopLine Value="1245"/>
<UsageCount Value="10"/>
</Unit18>
<Unit19>
<Filename Value="..\..\..\..\..\lazarus211\fpc\2.1.1\source\rtl\inc\except.inc"/>
<CursorPos X="1" Y="203"/>
<TopLine Value="172"/>
<UsageCount Value="10"/>
</Unit19>
<Unit20>
<Filename Value="..\..\..\..\..\lazarus211\fpc\2.1.1\source\rtl\objpas\typinfo.pp"/>
<UnitName Value="typinfo"/>
<CursorPos X="1" Y="483"/>
<TopLine Value="470"/>
<UsageCount Value="10"/>
</Unit20>
</Units>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="..\files\free\;$(LazarusDir)\others_package\synapse\;..\..\;$(LazarusDir)\others_package\ics\latest_distr\Delphi\Vc32\"/>
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\;$(LazarusDir)\others_package\synapse\"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="18">
<Item1>
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
<Line Value="15"/>
</Item1>
<Item2>
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
<Line Value="16"/>
</Item2>
<Item3>
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\test_soap.pas"/>
<Line Value="18"/>
</Item3>
<Item4>
<Source Value="..\google_api\home\inoussa\Projets\Laz\tests\soap\googleintfimpunit.pas"/>
<Line Value="63"/>
</Item4>
<Item5>
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\indy_http_protocol.pas"/>
<Line Value="69"/>
</Item5>
<Item6>
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\service_intf.pas"/>
<Line Value="567"/>
</Item6>
<Item7>
<Source Value="..\google_api\home\inoussa\Projets\Laz\v0.2\imp_utils.pas"/>
<Line Value="83"/>
</Item7>
<Item8>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="572"/>
</Item8>
<Item9>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="587"/>
</Item9>
<Item10>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="588"/>
</Item10>
<Item11>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="571"/>
</Item11>
<Item12>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="570"/>
</Item12>
<Item13>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="568"/>
</Item13>
<Item14>
<Source Value="..\test_suite\testformatter_unit.pas"/>
<Line Value="909"/>
</Item14>
<Item15>
<Source Value="..\files\free\AWSECommerceService_proxy.pas"/>
<Line Value="131"/>
</Item15>
<Item16>
<Source Value="..\..\base_service_intf.pas"/>
<Line Value="1698"/>
</Item16>
<Item17>
<Source Value="..\..\base_service_intf.pas"/>
<Line Value="1699"/>
</Item17>
<Item18>
<Source Value="..\..\base_service_intf.pas"/>
<Line Value="3662"/>
</Item18>
</BreakPoints>
<Watches Count="2">
<Item1>
<Expression Value="FScopeObject.Name"/>
</Item1>
<Item2>
<Expression Value="AOwner^.DataType"/>
</Item2>
</Watches>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,18 @@
program amazon;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms,
umain, AWSECommerceService;
begin
Application.Initialize;
Application.CreateForm(TfMain, fMain);
Application.Run;
end.

View File

@ -0,0 +1,120 @@
object fMain: TfMain
Left = 339
Height = 471
Top = 181
Width = 476
HorzScrollBar.Page = 475
VertScrollBar.Page = 470
ActiveControl = edtAccessID
Caption = 'WST Amazon - Sample'
Position = poDesktopCenter
object Label1: TLabel
Left = 16
Height = 18
Top = 24
Width = 69
Caption = 'Access Key'
Color = clNone
ParentColor = False
end
object Bevel1: TBevel
Left = 16
Height = 8
Top = 64
Width = 451
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
object Label2: TLabel
Left = 16
Height = 18
Top = 91
Width = 82
Caption = 'Search Index'
Color = clNone
ParentColor = False
end
object Label3: TLabel
Left = 16
Height = 18
Top = 142
Width = 82
Caption = 'Manufacturer'
Color = clNone
ParentColor = False
end
object Label4: TLabel
Left = 16
Height = 18
Top = 188
Width = 65
Caption = 'Key words'
Color = clNone
ParentColor = False
end
object Bevel2: TBevel
Left = 16
Height = 8
Top = 216
Width = 450
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
object edtAccessID: TEdit
Left = 118
Height = 23
Top = 24
Width = 202
TabOrder = 0
end
object edtSearchIndex: TEdit
Left = 127
Height = 23
Top = 91
Width = 338
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
Text = 'All'
end
object edtManufacturer: TEdit
Left = 127
Height = 23
Top = 142
Width = 338
Anchors = [akTop, akLeft, akRight]
TabOrder = 2
end
object mmoRes: TMemo
Left = 16
Height = 210
Top = 248
Width = 449
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (
'Memo1'
)
ScrollBars = ssAutoBoth
TabOrder = 3
WordWrap = False
end
object btnSearch: TButton
Left = 390
Height = 25
Top = 24
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 4
Caption = 'Search'
OnClick = btnSearchClick
TabOrder = 4
end
object edtKeywords: TEdit
Left = 127
Height = 23
Top = 188
Width = 338
Anchors = [akTop, akLeft, akRight]
TabOrder = 5
Text = 'Harry Potter'
end
end

View File

@ -0,0 +1,34 @@
{ Ceci est un fichier ressource g�n�r� automatiquement par Lazarus }
LazarusResources.Add('TfMain','FORMDATA',[
'TPF0'#6'TfMain'#5'fMain'#4'Left'#3'S'#1#6'Height'#3#215#1#3'Top'#3#181#0#5'W'
+'idth'#3#220#1#18'HorzScrollBar.Page'#3#219#1#18'VertScrollBar.Page'#3#214#1
+#13'ActiveControl'#7#11'edtAccessID'#7'Caption'#6#19'WST Amazon - Sample'#8
+'Position'#7#15'poDesktopCenter'#0#6'TLabel'#6'Label1'#4'Left'#2#16#6'Height'
+#2#18#3'Top'#2#24#5'Width'#2'E'#7'Caption'#6#10'Access Key'#5'Color'#7#6'clN'
+'one'#11'ParentColor'#8#0#0#6'TBevel'#6'Bevel1'#4'Left'#2#16#6'Height'#2#8#3
+'Top'#2'@'#5'Width'#3#195#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#5
+'Shape'#7#12'bsBottomLine'#0#0#6'TLabel'#6'Label2'#4'Left'#2#16#6'Height'#2
+#18#3'Top'#2'['#5'Width'#2'R'#7'Caption'#6#12'Search Index'#5'Color'#7#6'clN'
+'one'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#16#6'Height'#2#18#3
+'Top'#3#142#0#5'Width'#2'R'#7'Caption'#6#12'Manufacturer'#5'Color'#7#6'clNon'
+'e'#11'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#2#16#6'Height'#2#18#3
+'Top'#3#188#0#5'Width'#2'A'#7'Caption'#6#9'Key words'#5'Color'#7#6'clNone'#11
+'ParentColor'#8#0#0#6'TBevel'#6'Bevel2'#4'Left'#2#16#6'Height'#2#8#3'Top'#3
+#216#0#5'Width'#3#194#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#5'Shap'
+'e'#7#12'bsBottomLine'#0#0#5'TEdit'#11'edtAccessID'#4'Left'#2'v'#6'Height'#2
+#23#3'Top'#2#24#5'Width'#3#202#0#8'TabOrder'#2#0#0#0#5'TEdit'#14'edtSearchIn'
+'dex'#4'Left'#2''#6'Height'#2#23#3'Top'#2'['#5'Width'#3'R'#1#7'Anchors'#11#5
+'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#1#4'Text'#6#3'All'#0#0#5'TEdit'
+#15'edtManufacturer'#4'Left'#2''#6'Height'#2#23#3'Top'#3#142#0#5'Width'#3'R'
+#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#2#0#0#5'TMemo'
+#6'mmoRes'#4'Left'#2#16#6'Height'#3#210#0#3'Top'#3#248#0#5'Width'#3#193#1#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#13'Lines.Strings'#1
+#6#5'Memo1'#0#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#3#8'WordWrap'#8#0
+#0#7'TButton'#9'btnSearch'#4'Left'#3#134#1#6'Height'#2#25#3'Top'#2#24#5'Widt'
+'h'#2'K'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2
+#4#7'Caption'#6#6'Search'#7'OnClick'#7#14'btnSearchClick'#8'TabOrder'#2#4#0#0
+#5'TEdit'#11'edtKeywords'#4'Left'#2''#6'Height'#2#23#3'Top'#3#188#0#5'Width'
+#3'R'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#5#4'Text'
+#6#12'Harry Potter'#0#0#0
]);

View File

@ -0,0 +1,126 @@
unit umain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
AWSECommerceService, StdCtrls, ExtCtrls, Buttons;
type
{ TfMain }
TfMain = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
btnSearch: TButton;
edtAccessID: TEdit;
edtKeywords: TEdit;
edtSearchIndex: TEdit;
edtManufacturer: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
mmoRes: TMemo;
procedure btnSearchClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
fMain: TfMain;
implementation
uses soap_formatter,
synapse_http_protocol,
AWSECommerceService_proxy;
{ TfMain }
procedure TfMain.btnSearchClick(Sender: TObject);
var
locService : AWSECommerceServicePortType;
rqst : ItemSearch_Type;
rsps : ItemSearchResponse_Type;
rspsItem : Items_Type;
i, j, k, l : Integer;
locSearchBinSets : SearchBinSets_Type;
locSrchBinSet : SearchBinSet_Type;
locBin : Bin_Type;
bp : Bin_BinParameter_Type;
itm : Item_Type;
begin
mmoRes.Clear();
rsps := nil;
rqst := ItemSearch_Type.Create();
try
Screen.Cursor := crHourGlass;
locService := TAWSECommerceServicePortType_Proxy.Create(
'AWSECommerceServicePortType',
'SOAP:style=document;EncodingStyle=Literal',
'http:address=http://soap.amazon.com/onca/soap?Service=AWSECommerceService'
);
rqst.AWSAccessKeyId := edtAccessID.Text;
rqst.Request.SetLength(1);
rqst.Request[0].Manufacturer := edtManufacturer.Text;
rqst.Request[0].SearchIndex := edtSearchIndex.Text;
rqst.Request[0].Availability := Available;
rqst.Request[0].Count := 10;
rqst.Request[0].MerchantId := 'Amazon';
rqst.Request[0].ItemPage := 1;
rqst.Request[0].Keywords := edtKeywords.Text;
rsps := locService.ItemSearch(rqst);
if ( rsps.OperationRequest.Errors.Length > 0 ) then begin
mmoRes.Lines.Add(Format('Errors ( %d ) : ',[rsps.OperationRequest.Errors.Length]));
for i := 0 to Pred(rsps.OperationRequest.Errors.Length) do begin
mmoRes.Lines.Add(Format(' Error[%d] :',[i]));
mmoRes.Lines.Add(' ' + rsps.OperationRequest.Errors[i].Code);
mmoRes.Lines.Add(' ' + rsps.OperationRequest.Errors[i].Message);
end;
end else begin
mmoRes.Lines.Add(Format('Response ( %d ) : ',[rsps.Items.Length]));
if Assigned(rsps) then begin
for i := 0 to Pred(rsps.Items.Length) do begin
rspsItem := rsps.Items[i];
mmoRes.Lines.Add(' TotalPages :' + IntToStr(rspsItem.TotalPages));
mmoRes.Lines.Add(' TotalResults :' + IntToStr(rspsItem.TotalResults));
mmoRes.Lines.Add(' Items :' + IntToStr(rspsItem._Item.Length));
mmoRes.Lines.Add('');
for j := 0 to Pred(rspsItem._Item.Length) do begin
itm := rspsItem._Item[j];;
mmoRes.Lines.Add(' ASIN :' + itm.ASIN);
mmoRes.Lines.Add(' DetailPageURL :' + itm.DetailPageURL);
if Assigned(itm.ItemAttributes) then begin
mmoRes.Lines.Add(' Title :' + itm.ItemAttributes.Title);
for k := 0 to Pred(itm.ItemAttributes.Author.Length) do begin
mmoRes.Lines.Add(' Author[ ' + IntToStr(k) + ' ] ' + itm.ItemAttributes.Author.Item[k]);
end;
mmoRes.Lines.Add(' Manufacturer :' + itm.ItemAttributes.Manufacturer);
mmoRes.Lines.Add(' ProductGroup :' + itm.ItemAttributes.ProductGroup);
end;
mmoRes.Lines.Add('');
end;
end;
end else begin
ShowMessage('not Assigned(rsps)');
end;
end;
finally
Screen.Cursor := crDefault;
FreeAndNil(rqst);
FreeAndNil(rsps);
end;
end;
initialization
{$I umain.lrs}
Register_AWSECommerceService_ServiceMetadata();
SYNAPSE_RegisterHTTP_Transport();
end.

View File

@ -58,8 +58,8 @@
<Filename Value="generator.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="generator"/>
<CursorPos X="9" Y="1435"/>
<TopLine Value="1435"/>
<CursorPos X="3" Y="1581"/>
<TopLine Value="1424"/>
<EditorIndex Value="0"/>
<UsageCount Value="200"/>
<Bookmarks Count="3">
@ -249,8 +249,8 @@
<Unit26>
<Filename Value="wsdl2pas_imp.pas"/>
<UnitName Value="wsdl2pas_imp"/>
<CursorPos X="73" Y="1810"/>
<TopLine Value="1794"/>
<CursorPos X="63" Y="1815"/>
<TopLine Value="1791"/>
<EditorIndex Value="1"/>
<UsageCount Value="76"/>
<Bookmarks Count="1">
@ -343,128 +343,7 @@
<UsageCount Value="24"/>
</Unit39>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1537" Column="1" TopLine="1521"/>
</Position1>
<Position2>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1640" Column="1" TopLine="1624"/>
</Position2>
<Position3>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1783" Column="1" TopLine="1767"/>
</Position3>
<Position4>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1638" Column="1" TopLine="1622"/>
</Position4>
<Position5>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1537" Column="1" TopLine="1521"/>
</Position5>
<Position6>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1640" Column="1" TopLine="1624"/>
</Position6>
<Position7>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1537" Column="1" TopLine="1521"/>
</Position7>
<Position8>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1640" Column="1" TopLine="1624"/>
</Position8>
<Position9>
<Filename Value="generator.pas"/>
<Caret Line="1452" Column="69" TopLine="1436"/>
</Position9>
<Position10>
<Filename Value="generator.pas"/>
<Caret Line="1388" Column="40" TopLine="1372"/>
</Position10>
<Position11>
<Filename Value="generator.pas"/>
<Caret Line="1452" Column="96" TopLine="1436"/>
</Position11>
<Position12>
<Filename Value="generator.pas"/>
<Caret Line="1583" Column="38" TopLine="1567"/>
</Position12>
<Position13>
<Filename Value="generator.pas"/>
<Caret Line="1388" Column="40" TopLine="1372"/>
</Position13>
<Position14>
<Filename Value="generator.pas"/>
<Caret Line="1452" Column="96" TopLine="1436"/>
</Position14>
<Position15>
<Filename Value="parserdefs.pas"/>
<Caret Line="230" Column="3" TopLine="214"/>
</Position15>
<Position16>
<Filename Value="parserdefs.pas"/>
<Caret Line="1195" Column="41" TopLine="1179"/>
</Position16>
<Position17>
<Filename Value="parserdefs.pas"/>
<Caret Line="1186" Column="41" TopLine="1176"/>
</Position17>
<Position18>
<Filename Value="parserdefs.pas"/>
<Caret Line="258" Column="28" TopLine="235"/>
</Position18>
<Position19>
<Filename Value="parserdefs.pas"/>
<Caret Line="1215" Column="135" TopLine="1201"/>
</Position19>
<Position20>
<Filename Value="parserdefs.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position20>
<Position21>
<Filename Value="parserdefs.pas"/>
<Caret Line="265" Column="3" TopLine="241"/>
</Position21>
<Position22>
<Filename Value="generator.pas"/>
<Caret Line="1452" Column="101" TopLine="1435"/>
</Position22>
<Position23>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1531" Column="12" TopLine="1523"/>
</Position23>
<Position24>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1602" Column="12" TopLine="1586"/>
</Position24>
<Position25>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1604" Column="14" TopLine="1588"/>
</Position25>
<Position26>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1616" Column="14" TopLine="1600"/>
</Position26>
<Position27>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1395" Column="59" TopLine="1319"/>
</Position27>
<Position28>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="530" Column="40" TopLine="505"/>
</Position28>
<Position29>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position29>
<Position30>
<Filename Value="wsdl2pas_imp.pas"/>
<Caret Line="1809" Column="59" TopLine="1785"/>
</Position30>
</JumpHistory>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>

View File

@ -1812,7 +1812,7 @@ begin
classDef.AddProperty(
propTyp.Name,
FSymbols.ByName(Format('%s_%sArray',[internalName,propTyp.Name])) as TTypeDefinition
);
).RegisterExternalAlias(propTyp.ExternalName);
end;
end;
FreeAndNil(tmpClassDef);