title: How to add multiple http request calls in foreach | Mule 3
body: <p>I am using scatter-gather to call many endpoints with the same host and  different paths. How can I add the HTTP request connector inside For Each scope, that can loop into the different paths and add the payload to the same file?</p>
  <p>My code is as below, I would like to loop over the HTTP request;</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  
  &lt;mule xmlns:tracking=&quot;http://www.mulesoft.org/schema/mule/ee/tracking&quot; xmlns:ftp=&quot;http://www.mulesoft.org/schema/mule/ee/ftp&quot; xmlns:http=&quot;http://www.mulesoft.org/schema/mule/http&quot;
      xmlns:file=&quot;http://www.mulesoft.org/schema/mule/file&quot; xmlns:dw=&quot;http://www.mulesoft.org/schema/mule/ee/dw&quot;
      xmlns=&quot;http://www.mulesoft.org/schema/mule/core&quot; xmlns:doc=&quot;http://www.mulesoft.org/schema/mule/documentation&quot;
      xmlns:spring=&quot;http://www.springframework.org/schema/beans&quot; 
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
  http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/ee/ftp http://www.mulesoft.org/schema/mule/ee/ftp/current/mule-ftp-ee.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd&quot;&gt;
      &lt;http:request-config name=&quot;HTTP_Request_Configuration-testt&quot; protocol=&quot;HTTPS&quot; host=&quot;servicenow.com&quot; port=&quot;443&quot; doc:name=&quot;HTTP Request Configuration&quot;/&gt;
      &lt;http:listener-config name=&quot;HTTP_Listener_Configuration1&quot; host=&quot;0.0.0.0&quot; port=&quot;8081&quot; doc:name=&quot;HTTP Listener Configuration&quot;/&gt;
      &lt;flow name=&quot;servicenow-call&quot;&gt;
          &lt;http:listener config-ref=&quot;HTTP_Listener_Configuration1&quot; path=&quot;/test&quot; doc:name=&quot;HTTP&quot;/&gt;
          &lt;scatter-gather doc:name=&quot;Scatter-Gather&quot;&gt;
              &lt;http:request config-ref=&quot;HTTP_Request_Configuration-testt&quot; path=&quot;/repo/cat1&quot; method=&quot;GET&quot; doc:name=&quot;HTTP Request 1&quot;/&gt;
              &lt;http:request config-ref=&quot;HTTP_Request_Configuration-testt&quot; path=&quot;/repo/cat2&quot; method=&quot;GET&quot; doc:name=&quot;HTTP Request 2&quot;/&gt;
              &lt;http:request config-ref=&quot;HTTP_Request_Configuration-testt&quot; path=&quot;/repo/cat3&quot;&quot; method=&quot;GET&quot; doc:name=&quot;HTTP Request 4&quot;/&gt;
  
          &lt;/scatter-gather&gt;
          &lt;dw:transform-message doc:name=&quot;Set JSON&quot;&gt;
              &lt;dw:set-payload&gt;&lt;![CDATA[%dw 1.0
  %output application/json
  ---
  payload]]&gt;&lt;/dw:set-payload&gt;
          &lt;/dw:transform-message&gt;
          &lt;file:outbound-endpoint path=&quot;D:\Local\NewFile.json&quot; outputPattern=&quot;first-#[function:datestamp:ddMMyyyy-HHmmss].json&quot; responseTimeout=&quot;10000&quot; doc:name=&quot;Write FIle&quot;/&gt;
          &lt;exception-strategy ref=&quot;ImplementationChoice_Exception_Strategy&quot; doc:name=&quot;Reference Exception Strategy&quot;/&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>