I have been able to create a mailing using a VB script (createNewMailing) as below that will load an XML file and succesfuly obtain a return (ie mailing ID) but I'd really like to then use this return value straight away to insert into sendMail to trigger the mailing. The parameters will stay fixed for each mailing (ie list / target group etc) - the only variable will be the returned mailingID.
Any ideas? Can I incorporate the full SOAP XML details into the script rather than pulling in a separate file?
Many thanks in advance - it's a bit intense as the code seems to be so near ...!
Code: Select all
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "POST" , "http://testdomain.com:8080/emm_webservice", False
xmlhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded; charset=UTF-8"
xmlhttp.setRequestHeader "Content-length", "1000"
xmlhttp.setRequestHeader "Connection", "close"
xmlhttp.setRequestHeader "soapAction", "newEmailMailing"
Set oXML = CreateObject("Microsoft.XMLDOM")
oXML.async = False
oXML.load("C:\test.xml")
xmlhttp.send(oXML)
If(xmlhttp.readyState = 4) then
XMLResponse = xmlhttp.responseText
Msgbox XMLResponse
End If
The external XML file is as follows:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
- <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:urn="urn:agnitas-webservice">
<soapenv:Header />
- <soapenv:Body>
- <urn:newEmailMailing soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">testadmin</in0>
<in1 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">abc123</in1>
<in2 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">TEST_MAIL</in2>
<in3 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">WS_TEST_MAIL</in3>
<in4 xsi:type="xsd:int">8</in4>
- <in5 xsi:type="urn:StringArrayType">
- <!-- Zero or more repetitions:
-->
<x xsi:type="xsd:string">2</x>
</in5>
<in6 xsi:type="xsd:int">0</in6>
<in7 xsi:type="xsd:int">18</in7>
<in8 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Test</in8>
<in9 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</in9>
<in10 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</in10>
<in11 xsi:type="xsd:int">0</in11>
<in12 xsi:type="xsd:int">0</in12>
</urn:newEmailMailing>
</soapenv:Body>
</soapenv:Envelope>