title: Post SOAP Dynamic Envelope from Bash Script
body: <p>I want to post a soap envelope via bash.</p>
  
  <p>I can do this like that </p>
  
  <pre><code>#curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:"  -d @request.xml -X POST http://soap.sd.testdomain.com.tr/webservice/test
  </code></pre>
  
  <p>request.xml</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:tos="http://xx"&gt;    
  &lt;soapenv:Header/&gt;    
  &lt;soapenv:Body&gt;
  &lt;tos:createSend soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
  &lt;customerSend xsi:type="java:CustomerSend" xmlns:java="java:com.deneme.test.model"&gt;
  &lt;actionId xsi:type="xsd:long"&gt;&lt;/actionId&gt;
  &lt;actionStatus xsi:type="xsd:int"&gt;2&lt;/actionStatus&gt;
  &lt;/customerSend&gt;
  &lt;/tos:createSend&gt;    
  &lt;/soapenv:Body&gt; 
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>After first success this request i want to make a dynamic request by reading the data from file then make request for each line of the file .</p>
  
  <p>here is the example of my file </p>
  
  <p>1;2;AT-902737;Note;4</p>
  
  <p>1;2;AT-902738;Note;4</p>
  
  <p>I want to pass the AT-902737 parameters as actionId 
  and 4 parameter as actionStatus </p>
  
  <p>I tried to start the script but i can not complete :(</p>
  
  <pre><code>#!/bin/sh
  
  while IFS=";", read -r -a input; do
  
  printf "%s\n" "${input[2]}" "${input[4]}"
  
  
  #sed -i 's#\(&lt;actionId xsi:type="xsd:long"&gt;\)*\(&lt;/actionId&gt;\)#\1'"${input[2]}"'\2#g' request.xml
  
  #curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:"  -d @request.xml -X POST http://soap.sd.testdomain.com.tr/webservice/test
  </code></pre>
  
  <p>I tried but can not be succeed because ${input[2]} parameter shown as ${input[2]} in XML file. not as AT-902737</p>