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

c# login to IBM CLM exception

I try to login to IBM CLM server using some c# code from

http://blog.boriskuschel.com/2012/02/c-with-visual-studio-and-rational-team.html?showComment=1399373273027#c2233627067206926337

I am stuck at the part where the code throws an exception at the last instruction:

                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();
..
}
Error: The remote server returned an error: (408) Request Timeout.

I wonder whats wrong ...
Best regards
Can you please help ?

0 votes



2 answers

Permanent link
 Have you checked out https://jazz.net/library/article/601#How_VSClient_Fails_Login_Proxy_One? We've attached source code for a console application that logs into the Jazz server.

Cheers
--Rupa

1 vote

Comments

Hi,
The code fails with an exception -_-''

System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at JazzConsoleApplication.Program.SendRequest(String repository, String service, SecurityContext context) in C:\Users\timo\Desktop\JazzConsoleApplication_VS2010\JazzConsoleApplication\Program.cs:li
ne 128
   at JazzConsoleApplication.Program.Main(String[] args) in C:\Users\timo\Desktop\JazzConsoleApplication_VS2010\JazzConsoleApplication\Program.cs:line 39

I put
string repository = "https://timo-pcvirtual:9443/jazz/";
and the proxy stuff i didnt changed.

I have modified to
"https://timo-pcvirtual:9443/jts/";
Now the code does something untill
  Console.WriteLine("Getting Project Areas...");
                SendRequest(repository, "secure/service/com.ibm.team.process.internal.common.service.IProcessRestService/allProjectAreas?", context);
Here fails with error

System.Net.WebException: The remote server returned an error: (500) Internal Server Error.


Permanent link
The HTTP code 408 is quite tricky to troubleshoot. In the case of Jazz server form based authentication, it could be that Tomcat behaves unexpectedly to the /j_security_check request. Many people met the same or similar problem before. regardless what programming languages or scripts they used. You can search "j_security_check" on jazz.net to see how others failed or succeeded

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
× 11,074
× 87

Question asked: May 06 '14, 7:30 a.m.

Question was seen: 7,632 times

Last updated: May 09 '14, 7:02 a.m.

Confirmation Cancel Confirm