using System;
using System.Configuration;
using System.IO;
using System.Net;
using System.Xml;
using System.Threading;
namespace OneMDS_CreateJob
{
public class NewJob
{
static void Main(string[] args)
{
execJob(); Thread thr1 = new Thread(execJob); thr1.Start();
}
public static void execJob()
{
string sFileName;
string[] aJobTypes = ConfigurationManager.AppSettings["JobTypes"].Split(',');
string ServerName = ConfigurationManager.AppSettings["ServerName"];
for (int r = 0; r < aJobTypes.Length; r++) {
sFileName = aJobTypes[r] + ".xml";
if (File.Exists(sFileName)){
Console.WriteLine("file name is " + sFileName);
HttpWebRequest Req = (HttpWebRequest)WebRequest.Create(@"http://" + ServerName + "/Cgi.Ssp.Web.Site/InboundJobService.asmx");
Req.ContentType = "text/xml;charset=\"utf-8\"";
Req.Accept = "text/xml";
Req.Method = "POST";
XmlDocument SOAPReqBody = new XmlDocument();
SOAPReqBody.Load(aJobTypes[r] + ".xml");
using (Stream stream = Req.GetRequestStream())
{
SOAPReqBody.Save(stream);
}
//Geting response from request
using (WebResponse Serviceres = Req.GetResponse())
{
using (StreamReader rd = new StreamReader(Serviceres.GetResponseStream()))
{
var ServiceResult = rd.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(ServiceResult);
XmlNodeList jobId = xmlDoc.GetElementsByTagName("JobNumber");
Console.WriteLine("jobID " + jobId[0].InnerText);
}
}
}
}
}
}
}
29161716
67148811
two phone numbers to call moke.lv
using System.Net;
using System;
using System.IO;
using System.Xml;
using System.Web;
namespace LoadRunnerRest
{
class Program
{
static void Main(string[] args)
{
/**************************** LOGIN ***********************************************************************/
var request = (HttpWebRequest)WebRequest.Create("https://loadrunner.com/LoadTest/rest/authentication-point/authenticate");
String username = "username";
String password = "password";
String setCookie = "";
String sDomain = "";
String sProject = "";
String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
request.Headers.Add("Authorization", "Basic " + encoded);
request.CookieContainer = new CookieContainer();
var response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(response.StatusCode);
foreach (Cookie cook in response.Cookies)
{
if (cook.Name == "LWSSO_COOKIE_KEY")
{
setCookie = cook.Value;
//Console.WriteLine($"String: {setCookie}");
}
}
//}
/**************************** LOGOUT ***********************************************************************/
request = (HttpWebRequest)WebRequest.Create("https://loadrunner.com/LoadTest/rest/authentication-point/logout");
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(new Cookie("LWSSO_COOKIE_KEY", setCookie, "/", "lre.exeloncorp.com"));
response = (HttpWebResponse)request.GetResponse();
Console.WriteLine(response.StatusCode);
Console.ReadKey();
}
}
}