Parse_Part: For document style only look for element in schema.

For document style binding a part is defiend as:

   <part name="somename" element="elt"/>

And "elt" must only match element in the schema and not complexType or
simpleType.

Update some invalid WSDL in regression test.

TN eng/toolchain/aws#108
This commit is contained in:
Pascal Obry
2025-12-01 17:28:07 +01:00
parent 200cdbb2d6
commit bdeeb01a00
3 changed files with 9 additions and 2 deletions

View File

@@ -7,6 +7,7 @@
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<schema>
<xsd:element name="ExampleType" type="ExampleType"/>
<xsd:simpleType name="ExampleType">
<xsd:restriction base="xs:string">
<xsd:enumeration value="A-Example"/>

View File

@@ -7,6 +7,7 @@
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<schema>
<xsd:element name="ExampleType" type="ExampleType"/>
<xsd:complexType name="ExampleType">
<xsd:all>
<xsd:element name="type" type="xsd:int" minOccurs="0" maxOccurs="1"/>

View File

@@ -1932,6 +1932,7 @@ package body WSDL2AWS.WSDL.Parser is
A_Name : constant String := SOAP.XML.Get_Attr_Value (Part, "name");
N : DOM.Core.Node;
ET : Unbounded_String;
L_Ctx : Look_Context := Look_All;
begin
Trace ("(Parse_Part)", Part);
@@ -1948,6 +1949,9 @@ package body WSDL2AWS.WSDL.Parser is
O.Elmt_Name := ET;
end if;
-- For Document style binding, we look only for element in schema
-- as this is what is specified in part node.
L_Ctx := [Element => True, others => False];
else
-- for rpc style we use the type attribute
if A_Type = "" then
@@ -1984,10 +1988,11 @@ package body WSDL2AWS.WSDL.Parser is
raise WSDL_Error with "Type anyType is not supported.";
else
N := Look_For_Schema (Part, T, Document);
N := Look_For_Schema (Part, T, Document, L_Ctx);
if N = null then
raise WSDL_Error with "Definition for " & T & " not found.";
raise WSDL_Error
with "Definition for element " & T & " not found.";
end if;
Parse_Element (O, N, Document);