AnsweredAssumed Answered

Pass multiple parameters to start shape for max occurs unbounded element in XML profile?

Question asked by DavidNunez5371 on Dec 30, 2015
Latest reply on Oct 2, 2017 by Adam Arrowsmith

I have a start shape making a SOAP client call to a web service. The request schema has some elements that should be allowed to loop and my XML profile is configured with those elements set as Max Occurs = Unbounded.


What's happening is that when I pass parameters from the start shape as key-value pair children of a parent item element (for an associative array grouping), only the last group of elements is being written in the actual request XML. This is a completely unexpected behavior as I believe the start shape should recognize that the XML profile allows the parent item element to loop an unlimited amount of times. This does not appear to be the case, else I'm doing something wrong and need some guidance on how to properly accomplish this.

 

Here is an example of how I'm passing in the parameters:

 

0EM40000000IEsY

 

And here is an example of what is actually being generated as the request XML:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
    <SOAP-ENV:Body>
        <mns:salesOrderList xmlns:mns="urn:Magento" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <sessionId xsi:type="xsd:string">aaaabbbbccccdddd1111222233334444</sessionId>
            <filters xsi:type="typens:filters">
                <complex_filter xsi:type="soapenc:Array" soapenc:arrayType="typens:complexFilter[1]">
                    <item xsi:type="typens:associativeEntity"> <!-- ONLY 1 ITEM ELEMENT GENERATED! -->
                        <key xsi:type="xsd:string">updated_at</key>
                        <value xsi:type="typens:associativeEntity">
                            <key xsi:type="xsd:string">from</key>
                            <value xsi:type="xsd:string">2015-12-22 05:00:00</value>
                        </value>
                    </item>
                </complex_filter>
            </filters>
        </mns:salesOrderList>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is an example of what the XML request should look like:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typens="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
    <SOAP-ENV:Body>
        <mns:salesOrderList xmlns:mns="urn:Magento" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <sessionId xsi:type="xsd:string">aaaabbbbccccdddd1111222233334444</sessionId>
            <filters xsi:type="typens:filters">
                <complex_filter xsi:type="soapenc:Array" soapenc:arrayType="typens:complexFilter[2]">
                   <!-- THE ITEM ELEMENT BELOW SHOULD BE UNBOUNDED -->
                    <item xsi:type="typens:associativeEntity"> <!-- ITEM 1 -->
                        <key xsi:type="xsd:string">state</key>
                        <value xsi:type="typens:associativeEntity">
                            <key xsi:type="xsd:string">nin</key>
                            <value xsi:type="xsd:string">holded,canceled,closed,complete</value>
                        </value>
                    </item>
                    <item xsi:type="typens:associativeEntity"> <!-- ITEM 2 -->
                        <key xsi:type="xsd:string">updated_at</key>
                        <value xsi:type="typens:associativeEntity">
                            <key xsi:type="xsd:string">from</key>
                            <value xsi:type="xsd:string">2015-12-22 05:00:00</value>
                        </value>
                    </item>
                </complex_filter>
            </filters>
        </mns:salesOrderList>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Only the last item element is being written. I am expecting that it would generate an item element (and children) for each child element group that I pass as parameters. Is there any way to do something like this in a connector call and/or start shape with parameters? If not, what would be the best practice for generating request data of this kind?

Outcomes