Posted: 24 Sep 2015 8:09 EDT Last activity: 18 Nov 2016 3:19 EST
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)