class CampaignClients
{
}
public static server void getClient()
{
COM myXmlHttp;
url webServiceUrl;
str method;
str userName;
str password;
str strXML;
str strTxt;
str result;
str fileName;
str listValue;
int listLength;
int i;
System.Exception netExcepn;
InteropPermission permission;
FileIOPermission fileIOPerm;
COM receiveCom;
XMLDocument xmlDocu;
XMLDocument doc = XMLDOcument::newBlank();
XMLElement node;
XMLNodeList elemlist;
str s_Json;
;
try {
permission = new InteropPermission(InteropKind::ComInterop);
permission.assert();
myXmlHttp = new COM('Microsoft.XMLHTTP'); // used ms xml http com object to communicate with the web service
webServiceUrl = strfmt("https://api.createsend.com/api/v3/clients.json");
method = "GET";
fileName = "c:\\temp\\getRateFile.xml";
xmlDocu = XmlDocument::newBlank('utf-8');
CodeAccessPermission::revertAssert();
fileIOPerm = new FileIOPermission(fileName, 'r');
fileIOPerm.assert();
xmlDocu.load(fileName);
s_Json ='{"CompanyName": "Karya","Country": "India","TimeZone": "(GMT+10:00) Canberra, Melbourne, Sydney"}';
CodeAccessPermission::revertAssert();
permission = new InteropPermission(InteropKind::ComInterop);
permission.assert();
myXmlHttp.open(method,webServiceUrl,false,"2b4c0d6d781cbb43983e88674154cd39",password);
myXmlHttp.setRequestHeader("content-type","text/xml"); //application/x-www-form-urlencoded
myXmlHttp.send(s_Json);
strTxt =strrtrim(myXMLHttp.responseText());
info(strTxt);
receiveCom = myXMLHttp.responseXML();
doc.loadXml(receiveCom.xml());
elemList = doc.GetElementsByTagName("v3:Amount");
listLength = elemList.length();
for (i=0; i < elemList.length(); i++)
{
info(elemList.item(i).innerXml());
}
}
catch (exception::CLRError)
{
netExcepn = CLRInterop::getLastException();
info(netExcepn.ToString());
}
catch(exception::Error)
{
netExcepn = CLRInterop::getLastException();
info(netExcepn.ToString());
}
}
{
}
public static server void getClient()
{
COM myXmlHttp;
url webServiceUrl;
str method;
str userName;
str password;
str strXML;
str strTxt;
str result;
str fileName;
str listValue;
int listLength;
int i;
System.Exception netExcepn;
InteropPermission permission;
FileIOPermission fileIOPerm;
COM receiveCom;
XMLDocument xmlDocu;
XMLDocument doc = XMLDOcument::newBlank();
XMLElement node;
XMLNodeList elemlist;
str s_Json;
;
try {
permission = new InteropPermission(InteropKind::ComInterop);
permission.assert();
myXmlHttp = new COM('Microsoft.XMLHTTP'); // used ms xml http com object to communicate with the web service
webServiceUrl = strfmt("https://api.createsend.com/api/v3/clients.json");
method = "GET";
fileName = "c:\\temp\\getRateFile.xml";
xmlDocu = XmlDocument::newBlank('utf-8');
CodeAccessPermission::revertAssert();
fileIOPerm = new FileIOPermission(fileName, 'r');
fileIOPerm.assert();
xmlDocu.load(fileName);
s_Json ='{"CompanyName": "Karya","Country": "India","TimeZone": "(GMT+10:00) Canberra, Melbourne, Sydney"}';
CodeAccessPermission::revertAssert();
permission = new InteropPermission(InteropKind::ComInterop);
permission.assert();
myXmlHttp.open(method,webServiceUrl,false,"2b4c0d6d781cbb43983e88674154cd39",password);
myXmlHttp.setRequestHeader("content-type","text/xml"); //application/x-www-form-urlencoded
myXmlHttp.send(s_Json);
strTxt =strrtrim(myXMLHttp.responseText());
info(strTxt);
receiveCom = myXMLHttp.responseXML();
doc.loadXml(receiveCom.xml());
elemList = doc.GetElementsByTagName("v3:Amount");
listLength = elemList.length();
for (i=0; i < elemList.length(); i++)
{
info(elemList.item(i).innerXml());
}
}
catch (exception::CLRError)
{
netExcepn = CLRInterop::getLastException();
info(netExcepn.ToString());
}
catch(exception::Error)
{
netExcepn = CLRInterop::getLastException();
info(netExcepn.ToString());
}
}
No comments:
Post a Comment