Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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: "

https://<LOCALHOST>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<PROJECTNAME>/testplan/urn:com.ibm.rqm:testplan:<ID>"

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!

0 votes



2 answers

Permanent link
Max,
For a quick test, change your request headers to text/xml instead of application/xml and see if it makes any difference.


0 votes


Permanent link
Since you specify the Accept=application/xml header (Resource GET request without an Accept headers returns the 'Loading....' web page. (77982)), it appears you are not authenticating with the JTS server.  See com.ibm.rqm.url.client.RQMUrlUtlyLogin.login(String, String, String) in the RQM URL Utility source (https://jazz.net/wiki/bin/view/Main/RQMURLUtility#Accessing_the_Source - use the same version as your RQM server) for the required HTTP requests to authenticate with the JTS server.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 137
× 16
× 5

Question asked: Jan 03 '13, 8:46 a.m.

Question was seen: 6,826 times

Last updated: Jan 03 '13, 12:39 p.m.

Related questions
Confirmation Cancel Confirm