REST get via c# program (testplan /testcase)
Dear All,
I am writing a little c# program the main steps of it are:
->download a testplan / testcase and save it as an . xml file
I tried to achieve that result by using the REST api of the RQM. Unfortunately my program doesn't return the specified testplan /testcase but the sourcecode of an rational HTML page.
static string HttpGet(string url)
{
//Create web request
HttpWebRequest req = WebRequest.Create(url) as HttpWebRequest;
string result = null;
WebProxy myProxy = new WebProxy("myproxy", 80);
myProxy.BypassProxyOnLocal = true;
req.Proxy = WebProxy.GetDefaultProxy();
//Add authentication to request
req.Credentials = new NetworkCredential("myLogIn", "myPW");
req.Method = "GET";
req.ContentType = "application/xml";
req.Accept = "application/xml";
//Check and accept Certificate
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
delegate(
object sender,
System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
};
get response
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
get response stream
StreamReader reader = new StreamReader(resp.GetResponseStream());
result = reader.ReadToEnd();
}
return result;
}
I use the following URL:
The url I use is: "
I have tried it with the Rational URL Utility and it worked!
So please help me. I don't understand if somethings missing or wrong.
THANK YOU!