Reusability in XML response rules - working with Repeatable Apply Rules
As a requirement to make it reusable, for the Response Mapping we have implemented several node elements with the "Apply Rule" option enabled, so that we can refer to other MapFrom rules with elements in it.
"Parent" response rule
Though in the example above a requirement for the "deposit" element calling this rule is that it has to be repeatable, but not optional (so we get MinOccurs=1 and MaxOccurs=unbouded for this element in the generated WSDL). We have the check on the “Parent” element enabled (in the Node tab of the rule, we have enabled “Repeating”).
"Child" response rule
In the child response rule, we have the deposit elements, and the base Deposit element does not have the "Repeating" and "Optional" flag enabled. The elements here should be inserted in the parent response rule.
When we validate the response through SoapUI, it then returns errors that it is not schema compliant, specifically: "Element not allowed: deposit in element deposits".
Notice that the maxOccurs does not appear in the generated WSDL: (eventhough we have set the Repeatable flag)
- <complexType name="getDepositsResponseType">
- <sequence>
- <element minOccurs="1" name="deposits">
- <complexType>
- <sequence>
<element minOccurs="1" name="deposit" type="nslt1:depositType" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>
<element name="getDepositsResponse" type="nslt1:getDepositsResponseType" />
A workaround we implemented is to place all the elements in a single response rule. Though this way it is not reusable in other response rules calling the “child” response rule.
Any idea on how to fix the schema compliancy with the reusablity in place?