It's all about the answers!

Ask a question

how to connect from c# to IBM RQM


george claud (12811) | asked May 05 '14, 2:06 p.m.
How do i connect from c# to IBM RQM ?
When i used HP ALM i had some dlls which where registered on the client  machine, and then i would be using the c# using directive wih the name of the .dll
"using TDAPIOLELib;"
Ps: my plan is to use REST APIs ...to get :
-projects
-users
-testcases
-testscritps

and then to modify test script steps and upload it to the server...
I guess its possible but i am stuck at logging in ...

I digged in about OAuth but i couldnt find any code samples...

5 answers



permanent link
Paul Slauenwhite (8.4k12) | answered May 06 '14, 6:11 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
You can look at the authentication code of the RQM sample utilities (written in Java) that show the required requests for both basic and form authentication.  For example, see com.ibm.rqm.ct.client.internal.JFSHttpsClient.login(String, String) in the RQM Copy Utility (see https://jazz.net/wiki/bin/view/Main/RQMCopyUtility#Accessing_the_Source).

permanent link
george claud (12811) | answered May 06 '14, 7:27 a.m.
I have found some source code :
http://blog.boriskuschel.com/2012/02/c-with-visual-studio-and-rational-team.html?showComment=1399373273027#c2233627067206926337

but unfortunately fails when trying to login
             if ((header != null) && header.Equals("authrequired"))
                {
                    documentResponse.GetResponseStream().Flush();
                    documentResponse.Close();
                    // The server requires an authentication: Create the login form

                    HttpWebRequest formPost = (HttpWebRequest)WebRequest.Create(serverURI + "/j_security_check");
                    formPost.Method = "POST";
                    formPost.Timeout = 30000;
                    formPost.CookieContainer = request.CookieContainer;
                    formPost.ContentType = "application/x-www-form-urlencoded";
                    String output = "j_username=" + login + "&j_password=" + password;
                    Byte[] outputBuffer = Encoding.UTF8.GetBytes(output);
                    formPost.ContentLength = outputBuffer.Length;
                    Stream stream = formPost.GetRequestStream();
                    stream.Write(outputBuffer, 0, outputBuffer.Length);
                    stream.Close();

                    // Step (2): The client submits the login form
                    if (DEBUG) Console.WriteLine(">> POST " + formPost.RequestUri);
                    HttpWebResponse formResponse = (HttpWebResponse)formPost.GetResponse();
}
The code throws an exception
:Error: The remote server returned an error: (408) Request Timeout.

I wonder whats wrong...

permanent link
Stephane Leroy (1.4k149) | answered May 06 '14, 8:27 a.m.
JAZZ DEVELOPER
Hi George,

have you checked this blog post already ? It gives you some C# authentication sample code - here in the context of querying RTC WIs.

http://nkumar83.wordpress.com/2013/06/13/consuming-rtc-rational-team-concert-oslc-apis-using-c-post-1-authentication/

Regards,
Stéphane


Comments
george claud commented May 06 '14, 9:12 a.m.

The code is useless as expected...
I get the exception :
Error : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
on line:
var _serverResponse1 = _webClient.DownloadString(“https://localhost:9443/jazz/authenticated/identity”);


...??...



sam detweiler commented May 06 '14, 9:21 a.m.

> 9443/jazz/

that is the old pre-3.0 context. isn't it

9443/jts/ now for authentication?


george claud commented May 06 '14, 11:48 a.m.

 i dont understand your question


Stephane Leroy commented May 06 '14, 11:58 a.m.
JAZZ DEVELOPER

George, what Sam suggested is that you may need to adapt the sample to your own case (e.g. the URL for accessing the Jazz server).

You must see those URLs in your browser already.  So should be easy to check/fix...


george claud commented May 09 '14, 6:31 a.m.

I tried changing the adresses and it didnt work ...obviously


Stephane Leroy commented May 09 '14, 6:38 a.m.
JAZZ DEVELOPER

Have you checked the URL by entering it in a web browser (e.g. should not be an HTTP 404 error...) ?

showing 5 of 6 show 1 more comments

permanent link
george claud (12811) | answered May 06 '14, 8:36 a.m.
I will try , but so far working with IBM technology is a nightmare -_-...
I guess IBM never heard about c#...only Java crap...-_-''

permanent link
Karthick Raju (1112) | answered Mar 14 '16, 12:19 a.m.

I completely agree with you george claud. I would never consider myself moving to IBM technology. Everything is in JAVA :(

We are also planning to move to IBM RTC. I could not find any samples to access RQM. Is your code working now? Could you share me the working sample, would be great helpful for me?

I am doing PoC. It's very urgent.Could you help me?

Thanks in Advance!

Your answer


Register or 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.