Type Hint handling in the "message" component of wsdl files ( WideString, AnsiString, UnicodeString handling )

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@768 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa 2009-04-06 22:25:04 +00:00
parent f9723fb328
commit 85d250cfc0
12 changed files with 263 additions and 66 deletions

View File

@ -9,7 +9,7 @@
<PathDelim Value="\"/>
<SearchPaths>
<OtherUnitFiles Value="..\..\"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
@ -17,7 +17,8 @@
</SyntaxOptions>
</Parsing>
<Other>
<CustomOptions Value="-dINDY_10"/>
<CustomOptions Value="-dINDY_10
"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>

View File

@ -35,10 +35,10 @@
-N"obj"
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-U"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src"
-O"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src"
-I"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src"
-R"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src"
-U"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src"
-O"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src"
-I"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src"
-R"..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -94,7 +94,7 @@ OutputDir=
UnitOutputDir=obj
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
SearchPath=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src
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;dclOfficeXP;Rave70VCL;Rave70CLX;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;FIBDBMidas7;daADPhysADSD7;daADPhysODBCD7;daADPhysD7;daADComID7;daADPhysDBExpD7;daADPhysASAD7;daADPhysOraclD7;daADPhysMySQLD7;daADPhysDb2D7;daADPhysMSSQLD7;daADPhysMSAccD7;daADGUIxFormsD7;daADCompD7;CRControls70;dac70;dacvcl70;odacvcl70;odac70;oraprov70;dxGDIPlusD7;cxLibraryVCLD7;dxsbD7;dxComnD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxPageControlVCLD7;cxGridD7;cxSchedulerVCLD7;cxTreeListVCLD7;cxVerticalGridVCLD7;cxPivotGridD7;cxSpreadSheetVCLD7;dxDockingD7;dxNavBarD7;dxLayoutControlD7;dxLayoutControlcxEditAdaptersD7;cxWebD7;cxWebPascalScriptD7;cxWebSnapD7;cxWebTeeChartD7;dxMasterViewD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxFlowChartD7;dxPSCoreD7;dxPSLnksD7;dxPScxCommonD7;dxPScxGrid6LnkD7;dxPScxPCProdD7;dxPScxPivotGridLnkD7;dxPScxScheduler2LnkD7;dxPScxSSLnkD7;dxPScxTLLnkD7;dxPScxVGridLnkD7;dxPSTeeChartD7;dxPSdxOCLnkD7;dxPSdxDBTVLnkD7;dxPSdxFCLnkD7;dxPSdxLCLnkD7;dxPSdxMVLnkD7;dxPSdxDBOCLnkD7;dxPScxExtCommonD7;dxPsPrVwAdvD7;dxBarExtItemsD7;dxBarD7;dxPSDBTeeChartD7;cxBarEditItemD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxRibbonD7;S403_r70;S403br70
Conditionals=
DebugSourceDirs=
@ -141,21 +141,22 @@ Item0=DUnit
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[HistoryLists\hlSearchPath]
Count=14
Item0=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item1=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item2=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\ws_helper
Item3=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\fcl-units\fcl-passrc\src
Item4=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item5=..\;..\..\;..\..\..\;C:\Programmes\lazarus\wst\trunk\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item6=..\;..\..\;..\..\..\;..\..\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item7=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item8=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;C:\Programmes\lazarus\wst\trunk\ws_helper
Item9=..\;..\..\;..\..\..\;..\..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item10=..\;..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item11=..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item12=C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item13=..\
Count=15
Item0=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;$(DELPHI)\plate_forme\dunit\dunit-9.3.0\src
Item1=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item2=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Borland\Delphi7\MyTools\JVCL\3.20\jcl\lib\d7\debug;..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;..\..\..\ws_helper;..\..\..\wst_rtti_filter;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item3=..\;..\..\;..\..\..\;..\..\..\fcl-units\fcl-passrc\src;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\ws_helper
Item4=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;..\..\..\fcl-units\fcl-passrc\src
Item5=..\;..\..\;..\..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item6=..\;..\..\;..\..\..\;C:\Programmes\lazarus\wst\trunk\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item7=..\;..\..\;..\..\..\;..\..\ws_helper;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item8=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item9=..\;..\..\;..\..\..\;..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src;C:\Programmes\lazarus\wst\trunk\ws_helper
Item10=..\;..\..\;..\..\..\;..\..\..\ws_helper\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item11=..\;..\..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item12=..\;C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item13=C:\Program Files\Borland\Delphi7\plate_forme\dunit\dunit-9.3.0\src
Item14=..\
[HistoryLists\hlUnitOutputDirectory]
Count=1
Item0=obj

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<definitions name="uri:echo-service"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="uri:echo-service"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="uri:echo-service"
xmlns:wst="urn:wst_base">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:tns="uri:echo-service"
targetNamespace="uri:echo-service"/>
</types>
<message name="EchoWideString">
<part name="AValue" type="xsd:string" wst:TypeHint="WideString"/>
</message>
<message name="EchoWideStringResponse">
<part name="result" type="xsd:string" wst:TypeHint="WideString"/>
</message>
<portType name="IEchoService">
<document>
<GUID value="{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}"/>
</document>
<operation name="EchoWideString">
<input message="tns:EchoWideString"/>
<output message="tns:EchoWideStringResponse"/>
</operation>
</portType>
<binding name="IEchoServiceBinding" type="tns:IEchoService">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="EchoWideString">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal" namespace="uri:echo-service"/>
</input>
<output>
<soap:body use="literal" namespace="uri:echo-service"/>
</output>
</operation>
</binding>
<service name="IEchoService">
<port name="IEchoServicePort" binding="tns:IEchoServiceBinding">
<soap:address location=""/>
</port>
</service>
</definitions>

View File

@ -20,7 +20,7 @@ uses
{$ELSE}
TestFrameWork, xmldom, wst_delphi_xml,
{$ENDIF}
pastree, pascal_parser_intf, xsd_generator;
pastree, pascal_parser_intf, xsd_generator, wsdl_generator;
type
@ -56,6 +56,16 @@ type
function CreateGenerator(const ADoc : TXMLDocument) : IXsdGenerator;override;
end;
{ TTest_WsdlGenerator }
TTest_WsdlGenerator = class(TTestCase)
protected
function CreateGenerator(const ADoc : TXMLDocument) : IGenerator;
function LoadXmlFromFilesList(const AFileName : string) : TXMLDocument;
published
procedure message_parts_type_hint();
end;
implementation
uses
@ -517,7 +527,7 @@ begin
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,'.\class_unicodestring_property.xsd');
//WriteXMLFile(locDoc,'.\class_unicodestring_property.xsd');
locExistDoc := LoadXmlFromFilesList('class_unicodestring_property.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
@ -899,7 +909,7 @@ begin
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,'.\class_ansichar_property.xsd');
//WriteXMLFile(locDoc,'.\class_ansichar_property.xsd');
locExistDoc := LoadXmlFromFilesList('class_ansichar_property.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
@ -960,7 +970,7 @@ begin
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,'.\class_widechar_property.xsd');
//WriteXMLFile(locDoc,'.\class_widechar_property.xsd');
locExistDoc := LoadXmlFromFilesList('class_widechar_property.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
@ -977,7 +987,82 @@ begin
Result := TXsdGenerator.Create(ADoc) as IXsdGenerator;
end;
{ TTest_WsdlGenerator }
function TTest_WsdlGenerator.CreateGenerator(const ADoc : TXMLDocument) : IGenerator;
begin
Result := TWsdlGenerator.Create(ADoc) as IGenerator;
end;
function TTest_WsdlGenerator.LoadXmlFromFilesList(const AFileName : string) : TXMLDocument;
begin
ReadXMLFile(Result,wstExpandLocalFileName(TestFilesPath + AFileName));
end;
procedure TTest_WsdlGenerator.message_parts_type_hint();
var
tr : TwstPasTreeContainer;
mdl : TPasModule;
cltyp : TPasClassType;
procedure AddMethod_EchoWideString();
var
p : TPasFunction;
pt : TPasFunctionType;
prmDef : TPasArgument;
prmTypeDef : TPasType;
begin
p := TPasFunction(tr.CreateElement(TPasFunction,'EchoWideString',cltyp,visDefault,'',0));
pt := tr.CreateFunctionType('','result',p,False,'',0);
pt.ResultEl.ResultType := tr.FindElementNS('WideString',s_xs) as TPasType;
pt.ResultEl.ResultType.AddRef();
p.ProcType := pt;
cltyp.Members.Add(p);
prmTypeDef := tr.FindElementNS('WideString',s_xs) as TPasType;
prmDef := TPasArgument(tr.CreateElement(TPasArgument,'AValue',pt,visDefault,'',0));
pt.Args.Add(prmDef);
prmDef.ArgType := prmTypeDef;
prmTypeDef.AddRef();
prmDef.Access := argConst;
end;
var
g : IGenerator;
locDoc, locExistDoc : TXMLDocument;
begin
locDoc := nil;
locExistDoc := nil;
tr := TwstPasTreeContainer.Create();
try
CreateWstInterfaceSymbolTable(tr);
mdl := TPasModule(tr.CreateElement(TPasModule,'echo_service',tr.Package,visDefault,'',0));
tr.Package.Modules.Add(mdl);
tr.RegisterExternalAlias(mdl,'uri:echo-service');
mdl.InterfaceSection := TPasSection(tr.CreateElement(TPasSection,'',mdl,visDefault,'',0));
cltyp := TPasClassType(tr.CreateElement(TPasClassType,'IEchoService',mdl.InterfaceSection,visDefault,'',0));
cltyp.ObjKind := okInterface;
cltyp.InterfaceGUID := '{FCD0F68F-3023-46C6-AD09-1DDA4A2989EB}';
mdl.InterfaceSection.Declarations.Add(cltyp);
mdl.InterfaceSection.Types.Add(cltyp);
tr.AddBinding('IEchoServiceBinding',cltyp);
AddMethod_EchoWideString();
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
//WriteXMLFile(locDoc,wstExpandLocalFileName('echo_service.wsdl'));
locExistDoc := LoadXmlFromFilesList('echo_service.wsdl');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
FreeAndNil(tr);
end;
end;
initialization
RegisterTest('XSD generator',TTest_XsdGenerator.Suite);
RegisterTest('XSD-WSDL generator',TTest_XsdGenerator.Suite);
RegisterTest('XSD-WSDL generator',TTest_WsdlGenerator.Suite);
end.

View File

@ -175,6 +175,7 @@ type
procedure signature_return();
procedure xsd_not_declared_at_top_node();
procedure xsd_not_declared_at_top_node_2();
procedure message_parts_type_hint();
end;
implementation
@ -2199,6 +2200,55 @@ begin
ParseDoc('xsd_not_declared_at_top_node_2').Free();
end;
procedure TTest_WsdlParser.message_parts_type_hint();
function FindProc(const AName : string; AIntf : TPasClassType) : TPasProcedure;
var
k : Integer;
begin
Result := nil;
for k := 0 to (AIntf.Members.Count - 1) do begin
if TObject(AIntf.Members[k]).InheritsFrom(TPasProcedure) and ( TPasProcedure(AIntf.Members[k]).Name = AName ) then begin
Result := TPasProcedure(AIntf.Members[k]);
Break;
end;
end;
end;
var
tr : TwstPasTreeContainer;
elt : TPasElement;
intf : TPasClassType;
mth : TPasProcedure;
mthType : TPasProcedureType;
res : TPasResultElement;
arg : TPasArgument;
begin
tr := ParseDoc('echo_service');
try
elt := tr.FindElement('IEchoService');
CheckNotNull(elt,'IEchoService');
CheckIs(elt,TPasClassType);
intf := elt as TPasClassType;
CheckEquals(Ord(okInterface),Ord(intf.ObjKind));
mth := FindProc('EchoWideString',intf);
CheckNotNull(mth,'EchoWideString not found');
CheckEquals('EchoWideString',mth.Name);
mthType := mth.ProcType;
CheckIs(mthType,TPasFunctionType);
res := TPasFunctionType(mthType).ResultEl;
CheckNotNull(res, 'Result');
CheckEquals(LowerCase('WideString'), LowerCase(res.ResultType.Name),'Result');
CheckEquals(1, mthType.Args.Count, 'Parameter count');
arg := TPasArgument(mthType.Args[0]);
CheckNotNull(arg);
CheckEquals(LowerCase('AValue'), LowerCase(arg.Name));
CheckEquals(LowerCase('WideString'), LowerCase(arg.ArgType.Name),'Parameter');
finally
tr.Free();
end;
end;
function TTest_WsdlParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer;
begin
Result := ParseDoc(x_complexType_class_default);

View File

@ -2,11 +2,13 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value=".\"/>
<TargetFileExt Value=".exe"/>
</General>
<PublishOptions>

View File

@ -2,11 +2,13 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value=".\"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
@ -141,6 +143,9 @@
<CompilerOptions>
<Version Value="8"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="wst_test_suite_gui"/>
</Target>
<SearchPaths>
<IncludeFiles Value="..\..\"/>
<OtherUnitFiles Value="..\..\;..\..\ws_helper\;..\..\wst_rtti_filter\;..\..\fcl-json\src\"/>
@ -169,7 +174,7 @@
</Options>
</Linking>
<Other>
<CustomOptions Value="-FE./
<CustomOptions Value="
"/>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -2,11 +2,13 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
@ -42,7 +44,6 @@
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="uwsttypelibraryedit.lrs"/>
<UnitName Value="uwsttypelibraryedit"/>
</Unit1>
<Unit2>
@ -50,7 +51,6 @@
<ComponentName Value="fAbout"/>
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="uabout.lrs"/>
<UnitName Value="uabout"/>
</Unit2>
<Unit3>
@ -59,7 +59,6 @@
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufenumedit.lrs"/>
<UnitName Value="ufEnumedit"/>
</Unit3>
<Unit4>
@ -83,7 +82,6 @@
<HasResources Value="True"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufclassedit.lrs"/>
<UnitName Value="ufclassedit"/>
</Unit7>
<Unit8>
@ -91,14 +89,12 @@
<ComponentName Value="fPropEdit"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufpropedit.lrs"/>
<UnitName Value="ufpropedit"/>
</Unit8>
<Unit9>
<Filename Value="uinterfaceedit.pas"/>
<ComponentName Value="fInterfaceEdit"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="uinterfaceedit.lrs"/>
<UnitName Value="uinterfaceedit"/>
</Unit9>
<Unit10>
@ -106,7 +102,6 @@
<ComponentName Value="DM"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="DataModule"/>
<ResourceFilename Value="udm.lrs"/>
<UnitName Value="udm"/>
</Unit10>
<Unit11>
@ -123,7 +118,6 @@
<Filename Value="uprocedit.pas"/>
<ComponentName Value="fProcEdit"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="uprocedit.lrs"/>
<UnitName Value="uprocedit"/>
</Unit13>
<Unit14>
@ -135,21 +129,18 @@
<Filename Value="uargedit.pas"/>
<ComponentName Value="fArgEdit"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="uargedit.lrs"/>
<UnitName Value="uargedit"/>
</Unit15>
<Unit16>
<Filename Value="umoduleedit.pas"/>
<ComponentName Value="fModuleEdit"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="umoduleedit.lrs"/>
<UnitName Value="umoduleedit"/>
</Unit16>
<Unit17>
<Filename Value="ubindingedit.pas"/>
<ComponentName Value="fBindingEdit"/>
<IsPartOfProject Value="True"/>
<ResourceFilename Value="ubindingedit.lrs"/>
<UnitName Value="ubindingedit"/>
</Unit17>
<Unit18>
@ -157,7 +148,6 @@
<ComponentName Value="frmSaveOptions"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufrmsaveoption.lrs"/>
<UnitName Value="ufrmsaveoption"/>
</Unit18>
<Unit19>
@ -165,7 +155,6 @@
<ComponentName Value="fArrayEdit"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufarrayedit.lrs"/>
<UnitName Value="ufarrayedit"/>
</Unit19>
<Unit20>
@ -173,7 +162,6 @@
<ComponentName Value="fTypeAliasEdit"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="uftypealiasedit.lrs"/>
<UnitName Value="uftypealiasedit"/>
</Unit20>
<Unit21>
@ -181,7 +169,6 @@
<ComponentName Value="fRecordEdit"/>
<IsPartOfProject Value="True"/>
<ResourceBaseClass Value="Form"/>
<ResourceFilename Value="ufrecordedit.lrs"/>
<UnitName Value="ufrecordedit"/>
</Unit21>
<Unit22>

View File

@ -2,16 +2,16 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value=".\"/>
<TargetFileExt Value=""/>
</General>
<PublishOptions>

View File

@ -176,6 +176,7 @@ procedure TWsdlGenerator.GenerateServiceMessages(
tmpNode : TDOMElement;
ns_shortName, s : string;
typItm : TPasType;
typeHelper : IXsdSpecialTypeHelper;
begin
tmpNode := CreateElement(s_part,AMsgNode,Document);
tmpNode.SetAttribute(s_name,ASymTable.GetExternalName(APrm));
@ -187,6 +188,10 @@ procedure TWsdlGenerator.GenerateServiceMessages(
ns_shortName := GetNameSpaceShortName(s,Document,nil);
s := Format('%s:%s',[ns_shortName,ASymTable.GetExternalName(typItm)]);
tmpNode.SetAttribute(s_type,s);
if typItm.InheritsFrom(TPasNativeSpecialSimpleType) then begin
if GetXsdTypeHandlerRegistry().FindHelper(typItm,typeHelper) then
typeHelper.HandleTypeUsage(tmpNode,ARootNode);
end;
end;
procedure GenerateResultParam(APrm : TPasResultElement; AMsgNode : TDOMElement);
@ -194,6 +199,7 @@ procedure TWsdlGenerator.GenerateServiceMessages(
tmpNode : TDOMElement;
ns_shortName, s : string;
typItm : TPasType;
typeHelper : IXsdSpecialTypeHelper;
begin
tmpNode := CreateElement(s_part,AMsgNode,Document);
tmpNode.SetAttribute(s_name,ASymTable.GetExternalName(APrm));
@ -205,6 +211,10 @@ procedure TWsdlGenerator.GenerateServiceMessages(
ns_shortName := GetNameSpaceShortName(s,Document,nil);
s := Format('%s:%s',[ns_shortName,ASymTable.GetExternalName(typItm)]);
tmpNode.SetAttribute(s_type,s);
if typItm.InheritsFrom(TPasNativeSpecialSimpleType) then begin
if GetXsdTypeHandlerRegistry().FindHelper(typItm,typeHelper) then
typeHelper.HandleTypeUsage(tmpNode,ARootNode);
end;
end;
var

View File

@ -75,7 +75,7 @@ type
const ASoapBindingStyle : string
) : TPasProcedure;
function GetParser(const ANamespace : string) : IXsdPaser;
function ParseType(const AName : string) : TPasType;
function ParseType(const AName : string; const AHint : string = '') : TPasType;
procedure ParseTypes();
protected
function GetXsShortNames() : TStrings;
@ -449,11 +449,17 @@ function TWsdlParser.ParseOperation(
if Assigned(Result) then
Result := CreateCursorOn(Result,CreateWsdlNameFilter(s_part));
end;
function ExtractTypeHint(AElement : TDOMNode) : string;
begin
if not wst_findCustomAttributeXsd(FXSShortNames,AElement,s_WST_typeHint,Result) then
Result := '';
end;
function GetDataType(const AName, ATypeOrElement : string):TPasType;
function GetDataType(const AName, ATypeOrElement : string; const ATypeHint : string = ''):TPasType;
begin
try
Result := ParseType(AName);
Result := ParseType(AName,ATypeHint);
except
on e : Exception do begin
DoOnMessage(mtError, e.Message + ' ' + AName + ' ' + ATypeOrElement);
@ -490,7 +496,7 @@ function TWsdlParser.ParseOperation(
if ( crs <> nil ) then begin
crs.Reset();
while crs.MoveNext() do begin
tmpNode := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
tmpNode := TDOMNodeRttiExposer(crs.GetCurrent()).InnerObject;
if ( tmpNode.Attributes = nil ) or ( tmpNode.Attributes.Length < 1 ) then begin
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
end;
@ -503,7 +509,7 @@ function TWsdlParser.ParseOperation(
if not tmpCrs.MoveNext() then begin
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
end;
prmName := (tmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeValue;
prmName := TDOMNodeRttiExposer(tmpCrs.GetCurrent()).NodeValue;
strBuffer := s_NODE_NAME + '=' + QuotedStr(s_element) + ' or ' + s_NODE_NAME + ' = ' + QuotedStr(s_type);
tmpCrs := CreateCursorOn(
CreateAttributesCursor(tmpNode,cetRttiNode),
@ -513,8 +519,8 @@ function TWsdlParser.ParseOperation(
if not tmpCrs.MoveNext() then begin
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
end;
prmTypeName := (tmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeValue;
prmTypeType := (tmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeName;
prmTypeName := TDOMNodeRttiExposer(tmpCrs.GetCurrent()).NodeValue;
prmTypeType := TDOMNodeRttiExposer(tmpCrs.GetCurrent()).NodeName;
if IsStrEmpty(prmName) or IsStrEmpty(prmTypeName) or IsStrEmpty(prmTypeType) then begin
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
end;
@ -534,7 +540,7 @@ function TWsdlParser.ParseOperation(
prmInternameName := '_' + prmInternameName;
end;
prmHasInternameName := not AnsiSameText(prmInternameName,prmName);
prmTypeDef := GetDataType(prmTypeName,prmTypeType);
prmTypeDef := GetDataType(prmTypeName,prmTypeType,ExtractTypeHint(tmpNode));
prmDef := TPasArgument(SymbolTable.CreateElement(TPasArgument,prmInternameName,tmpMthdType,visDefault,'',0));
tmpMthdType.Args.Add(prmDef);
prmDef.ArgType := prmTypeDef;
@ -610,7 +616,7 @@ function TWsdlParser.ParseOperation(
prmDef := nil;
crs.Reset();
while crs.MoveNext() do begin
tmpNode := (crs.GetCurrent() as TDOMNodeRttiExposer).InnerObject;
tmpNode := TDOMNodeRttiExposer(crs.GetCurrent()).InnerObject;
if ( tmpNode.Attributes = nil ) or ( tmpNode.Attributes.Length < 1 ) then
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
strBuffer := s_NODE_NAME + '=' + QuotedStr(s_name);
@ -627,8 +633,8 @@ function TWsdlParser.ParseOperation(
tmpCrs.Reset();
if not tmpCrs.MoveNext() then
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
prmTypeName := (tmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeValue;
prmTypeType := (tmpCrs.GetCurrent() as TDOMNodeRttiExposer).NodeName;
prmTypeName := TDOMNodeRttiExposer(tmpCrs.GetCurrent()).NodeValue;
prmTypeType := TDOMNodeRttiExposer(tmpCrs.GetCurrent()).NodeName;
if IsStrEmpty(prmName) or IsStrEmpty(prmTypeName) or IsStrEmpty(prmTypeType) then
raise EXsdInvalidDefinitionException.CreateFmt('Invalid message part : "%s"',[tmpNode.NodeName]);
if SameText(s_document,ASoapBindingStyle) and
@ -650,7 +656,7 @@ function TWsdlParser.ParseOperation(
if ( prmDef = nil ) then begin
prmDef := TPasArgument(SymbolTable.CreateElement(TPasArgument,prmInternameName,tmpMthdType,visDefault,'',0));
tmpMthdType.Args.Add(prmDef);
prmDef.ArgType := GetDataType(prmTypeName,prmTypeType);
prmDef.ArgType := GetDataType(prmTypeName,prmTypeType,ExtractTypeHint(tmpNode));
prmDef.ArgType.AddRef();
prmDef.Access := argOut;
if prmHasInternameName then begin
@ -662,7 +668,7 @@ function TWsdlParser.ParseOperation(
end else begin
prmInternameName := '_' + prmInternameName;
prmDef := TPasArgument(SymbolTable.CreateElement(TPasArgument,prmInternameName,tmpMthdType,visDefault,'',0));
prmDef.ArgType := GetDataType(prmTypeName,prmTypeType);
prmDef.ArgType := GetDataType(prmTypeName,prmTypeType,ExtractTypeHint(tmpNode));
prmDef.ArgType.AddRef();
prmDef.Access := argOut;
tmpMthdType.Args.Add(prmDef);
@ -1110,7 +1116,7 @@ begin
end;
end;
function TWsdlParser.ParseType(const AName : string) : TPasType;
function TWsdlParser.ParseType(const AName : string; const AHint : string) : TPasType;
var
localName, spaceShort, spaceLong : string;
locPrs : IXsdPaser;
@ -1119,7 +1125,11 @@ begin
ExplodeQName(AName,localName,spaceShort);
if ( FXSShortNames.IndexOf(spaceShort) >= 0 ) then begin
xsdModule := SymbolTable.FindModule(s_xs);
Result := SymbolTable.FindElementInModule(localName,xsdModule) as TPasType;
Result := nil;
if not IsStrEmpty(AHint) then
Result := SymbolTable.FindElementInModule(AHint,xsdModule,[elkName]) as TPasType;
if ( Result = nil ) then
Result := SymbolTable.FindElementInModule(localName,xsdModule) as TPasType;
if ( Result = nil ) then
raise EXsdTypeNotFoundException.CreateFmt('Type not found : "%s".',[AName]);
end else begin