title: Have list of objects in response with wso2 mediator
body: <p>I create a rest API with 'Get' source.It has parameters in input and with In and Out mediator convert json to soap and then soap to Json to make my output.
  The output is List of objects. It works correct if there is more than one object in the list. But if I have an object, I expect a list consist of one object in response but the output is just an object. And list is omitted.
  Is anything wrong with my mediators??</p>
  
  <p>Here is the JsonToSoap mediator(In mediator) :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;sequence name="LivePricesJsonToSoap.xml" trace="disable" xmlns="http://ws.apache.org/ns/synapse"&gt;
  &lt;property name="HTTP_METHOD" scope="axis2" type="STRING" value="POST"/&gt;
  &lt;header name="Action" scope="default" value="http://tempuri.org/ILivePublisher/LivePrices"/&gt;
  &lt;property expression="$url:instrumentIsin" name="req.var.instrumentIsin" scope="default" type="STRING"/&gt;
  &lt;property expression="$url:since" name="req.var.since" scope="default" type="STRING"/&gt;
  &lt;property expression="$url:to" name="req.var.to" scope="default" type="STRING"/&gt;
  &lt;property expression="$url:interval" name="req.var.interval" scope="default" type="STRING"/&gt;
  &lt;payloadFactory media-type="xml"&gt;
      &lt;format&gt;
          &lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
              &lt;s:Body&gt;
                  &lt;LivePrices xmlns="http://tempuri.org/"&gt;
                      &lt;instrumentIsin&gt;$1&lt;/instrumentIsin&gt;
                      &lt;since&gt;$2&lt;/since&gt;
                      &lt;to&gt;$3&lt;/to&gt;
                      &lt;interval&gt;$4&lt;/interval&gt;
                  &lt;/LivePrices&gt;
              &lt;/s:Body&gt;
          &lt;/s:Envelope&gt;
      &lt;/format&gt;
      &lt;args&gt;
          &lt;arg evaluator="xml" expression="get-property('req.var.instrumentIsin')"/&gt;
          &lt;arg evaluator="xml" expression="get-property('req.var.since')"/&gt;
          &lt;arg evaluator="xml" expression="get-property('req.var.to')"/&gt;
          &lt;arg evaluator="xml" expression="get-property('req.var.interval')"/&gt;
      &lt;/args&gt;
  &lt;/payloadFactory&gt;
  &lt;property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/&gt;
  &lt;/sequence&gt;
  </code></pre>
  
  <p>and the SoapToJson mediator(Out mediator):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;sequence name="LivePricesSoupToJson.xml" trace="disable" xmlns="http://ws.apache.org/ns/synapse"&gt;
  &lt;payloadFactory media-type="xml"&gt;
      &lt;format&gt;
          &lt;m:Response xmlns:m="http://schemas.xmlsoap.org/soap/envelope/"&gt;$1&lt;/m:Response&gt;
      &lt;/format&gt;
      &lt;args&gt;
          &lt;arg evaluator="xml" expression="//s:Envelope/s:Body/t:LivePricesResponse/t:LivePricesResult/a:Close" xmlns:a="http://schemas.datacontract.org/2004/07/Asa.Mbdp.Platform.Publish.Tmc.Head.Proxy" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://tempuri.org/"/&gt;
      &lt;/args&gt;
  &lt;/payloadFactory&gt;
  &lt;foreach expression="//m:Response/a:Close" 
  xmlns:a="http://schemas.datacontract.org/2004/07/Asa.Mbdp.Platform.Publish.Tmc.Head.Proxy" 
  xmlns:m="http://schemas.xmlsoap.org/soap/envelope/"&gt;
      &lt;sequence&gt;
          &lt;payloadFactory media-type="xml"&gt;
              &lt;format&gt;
                  &lt;m:LivePrices&gt;
                      &lt;m:Last&gt;$1&lt;/m:Last&gt;
                      &lt;m:Price&gt;$2&lt;/m:Price&gt;
                      &lt;m:Quantity&gt;$3&lt;/m:Quantity&gt;
                      &lt;m:Since&gt;$4&lt;/m:Since&gt;
                  &lt;/m:LivePrices&gt;
              &lt;/format&gt;
              &lt;args&gt;
                  &lt;arg evaluator="xml" expression="//a:Close/a:Last"/&gt;
                  &lt;arg evaluator="xml" expression="//a:Close/a:Price"/&gt;
                  &lt;arg evaluator="xml" expression="//a:Close/a:Quantity"/&gt;
                  &lt;arg evaluator="xml" expression="//a:Close/a:Since"/&gt;
              &lt;/args&gt;
          &lt;/payloadFactory&gt;
      &lt;/sequence&gt;
  &lt;/foreach&gt;
  &lt;property name="messageType" scope="axis2" type="STRING" value="application/json"/&gt;
  &lt;/sequence&gt;
  </code></pre>
  
  <p>Response with more than one object in list is :</p>
  
  <pre><code>{
  "Response": {
  "LivePrices": [
    {
      "Last": 2100,
      "Price": 2075,
      "Quantity": 29252869,
      "Since": "2018-07-18T00:00:00"
    },
    {
      "Last": 2067,
      "Price": 2067,
      "Quantity": 40790,
      "Since": "2018-07-24T11:04:35"
    },
    {
      "Last": 2067,
      "Price": 2067,
      "Quantity": 40790,
      "Since": "2018-07-24T11:08:35"
     }
    ]
   }
  }
  </code></pre>
  
  <p>and response with one object is :</p>
  
  <pre><code>{
  "Response": {
  "LivePrices": {
    "Last": 1903,
    "Price": 1911,
    "Quantity": 15345096,
    "Since": "2018-07-24T00:00:00"
    }
   }
  }
  </code></pre>