fix wsdl operation attributes parsing when there are multiple attributes : unit test.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1243 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2010-07-02 15:33:29 +00:00
parent c5eeaadf18
commit 19b53bc223
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<?xml version="1.0"?>
<definitions name="library1" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="urn:test">
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:test" targetNamespace="urn:test"/>
</types>
<message name="test_proc">
<part name="AConstParam" type="xsd:string"/>
</message>
<message name="test_procResponse">
<part name="AOutParam" type="xsd:boolean"/>
<part name="AResParam" type="xsd:int"/>
</message>
<portType name="TestService">
<document>
<GUID value="{2E64ADA6-BF3F-4C88-89BF-17709416B11C}"/>
</document>
<operation name="test_proc">
<input message="tns:test_proc"/>
<output message="tns:test_procResponse"/>
</operation>
</portType>
<binding name="TestServiceBinding" type="tns:TestService">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="test_proc">
<soap:operation soapAction="http://wst.Sample/Soap/Action/"/>
<input>
<soap:body use="literal" namespace="library1"/>
</input>
<output>
<soap:body use="literal" namespace="library1"/>
</output>
</operation>
</binding>
<service name="TestService">
<port name="TestServicePort" binding="tns:TestServiceBinding">
<soap:address location=""/>
</port>
</service>
</definitions>

View File

@ -198,6 +198,7 @@ type
procedure message_parts_type_hint(); procedure message_parts_type_hint();
procedure parameter_var(); procedure parameter_var();
procedure parameter_const_default(); procedure parameter_const_default();
procedure soap_action();
end; end;
implementation implementation
@ -2665,6 +2666,38 @@ begin
end; end;
end; end;
procedure TTest_WsdlParser.soap_action();
var
tr : TwstPasTreeContainer;
elt : TPasElement;
intf : TPasClassType;
i : Integer;
mth : TPasProcedure;
begin
tr := ParseDoc('soap_action');
try //SymbolTable.Properties.SetValue(AOp,s_TRANSPORT + '_' + s_soapAction,nd.NodeValue);
elt := tr.FindElement('TestService');
CheckNotNull(elt,'TestService');
CheckIs(elt,TPasClassType);
intf := elt as TPasClassType;
mth := nil;
for i := 0 to (intf.Members.Count - 1) do begin
if TObject(intf.Members[i]).InheritsFrom(TPasProcedure) then begin
mth := TPasProcedure(intf.Members[i]);
Break;
end;
end;
CheckNotNull(mth,'test_proc not found');
CheckEquals('test_proc',mth.Name);
CheckEquals(
'http://wst.Sample/Soap/Action/',
tr.Properties.GetValue(mth,s_TRANSPORT + '_' + s_soapAction)
);
finally
tr.Free();
end;
end;
function TTest_WsdlParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer; function TTest_WsdlParser.LoadComplexType_Class_default_values() : TwstPasTreeContainer;
begin begin
Result := ParseDoc(x_complexType_class_default); Result := ParseDoc(x_complexType_class_default);