FlushCacheonDP.xml:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:request xmlns:m="http://www.datapower.com/schemas/management" domain="XXXXX">
<m:do-action>
<FlushDocumentCache>
<XMLManager class="XMLManager">default</XMLManager>
</FlushDocumentCache>
<FlushStylesheetCache>
<XMLManager class="XMLManager">default</XMLManager>
</FlushStylesheetCache>
</m:do-action>
</m:request>
</SOAP-ENV:Body>
I am using it in a curl call inside a python script, my problem is I want to call the curl with the above xml but the domain="XXXXX" has to pick differents strings like from an array.
here is how I am calling it :
from sys import argv
import subprocess
# run python cache2.py hosts.txt Test
with open(argv[1]) as f:
addresses = {i.split(" : ")[0] : i.split(" : ")[1] for i in f}
print(addresses[argv[2]])
command = "curl -k --data-binary @FlushCacheonDP.xml -u username@password https://" +addresses[argv[2]].strip()+ ":5550/service/mgmt/current > Response2\generated_Resp.xml"
print(command)
p = subprocess.Popen(command,shell=True, stdout=subprocess.PIPE).communicate()[0]
arrayDomain = ['EOT','ITD_TEST',......,'NSOPR']
I could call the same curl script many times, but it will be a redandont Thanks, your help is appreciated.