+ runtime WSDL generation : SOAP Header blocks should not derive from THeaderBlock

+ test case

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@862 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2009-06-25 23:21:48 +00:00
parent abf1f15cde
commit 0fc47f2004
5 changed files with 123 additions and 19 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<definitions name="runtime_generator"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="urn:sample-namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:sample-namespace">
<types>
<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wst="urn:wst_base"
targetNamespace="urn:sample-namespace">
<xsd:complexType name="TLoginHeader" wst:wst_headerBlock="true">
<xsd:sequence>
<xsd:element name="Login" type="xsd:string" maxOccurs="1" minOccurs="1"/>
<xsd:element name="Password" type="xsd:string" maxOccurs="1" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
</definitions>

View File

@ -977,7 +977,7 @@ begin
locDoc := CreateDoc();
g := CreateGenerator(locDoc);
g.Execute(tr,mdl.Name);
WriteXMLFile(locDoc,wstExpandLocalFileName('type_hint_record_item.xsd'));
//WriteXMLFile(locDoc,wstExpandLocalFileName('type_hint_record_item.xsd'));
locExistDoc := LoadXmlFromFilesList('type_hint_record_item.xsd');
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally

View File

@ -70,7 +70,16 @@ type
fieldWord : Word;
fieldString : string;
end;
TLoginHeader = class(THeaderBlock)
private
FLogin: string;
FPassword: string;
published
property Login : string read FLogin write FLogin;
property Password : string read FPassword write FPassword;
end;
{ TTestWSDLGenerator }
TTestWSDLGenerator= class(TTestCase)
@ -81,6 +90,7 @@ type
procedure generate_enum();
procedure generate_array();
procedure generate_record();
procedure generate_soap_headerblock();
end;
implementation
@ -257,6 +267,36 @@ begin
end;
end;
procedure TTestWSDLGenerator.generate_soap_headerblock();
var
locRep : PServiceRepository;
locDoc, locExistDoc : TXMLDocument;
typeReg : TTypeRegistry;
handlerReg : IWsdlTypeHandlerRegistry;
begin
locExistDoc := nil;
typeReg := nil;
locDoc := nil;
locRep := CreateRepository();
try
typeReg := TTypeRegistry.Create();
RegisterStdTypes(typeReg);
typeReg.Register(sNAMESPACE_SAMPLE,TypeInfo(TLoginHeader));
handlerReg := CreateWsdlTypeHandlerRegistry(typeReg);
RegisterFondamentalTypesHandler(handlerReg);
locDoc := CreateDoc();
GenerateWSDL(locRep,locDoc,typeReg,handlerReg);
//WriteXML(locDoc,wstExpandLocalFileName('generate_soap_headerblock.wsdl'));
ReadXMLFile(locExistDoc,wstExpandLocalFileName(TestFilesPath + 'wsdl_gen_soap_headerblock.wsdl'));
Check(CompareNodes(locExistDoc.DocumentElement,locDoc.DocumentElement),'generated document differs from the existent one.');
finally
typeReg.Free();
ReleaseDomNode(locExistDoc);
ReleaseDomNode(locDoc);
Dispose(locRep);
end;
end;
initialization
TClass_ABC.RegisterAttributeProperty('ABC_EnumAttProp');