It's all about the answers!

Ask a question

[closed] Not able to connect ClearQuest by programmatically


Raja P (1526) | asked Dec 13 '17, 4:15 a.m.
closed Dec 13 '17, 5:39 a.m. by Ralph Schoon (63.1k33646)

 I have to get all the defect details from ClearQuest and I have implemented the below using C#



CookieContainer _cookies = new CookieContainer();

HttpWebRequest documentGet = (HttpWebRequest)WebRequest.Create(resourceURL);
documentGet.Method = method; 
documentGet.CookieContainer = _cookies; 
documentGet.ContentType = "application/rdf+xml";
documentGet.Accept = mediatype;
documentGet.Headers.Set("OSLC-Core-Version", "3.0"); 
documentGet.Timeout = 300000;

HttpWebRequest _requestClone = (HttpWebRequest)WebRequest.Create(_request.RequestUri);

            //store the response in _docResponse variable
            HttpWebResponse _docResponse = (HttpWebResponse)_request.GetResponse();

            //HttpStatusCode.OK indicates that the request succeeded and that the requested information is in the response.
            if (_docResponse.StatusCode == HttpStatusCode.OK)
            {
                //X-com-ibm-team-repository-web-auth-msg header signifies form based authentication is being used
                string _rtcAuthHeader = _docResponse.Headers["X-com-ibm-team-repository-web-auth-msg"];
                if ((_rtcAuthHeader != null) && _rtcAuthHeader.Equals("authrequired"))
                {
                    _docResponse.GetResponseStream().Flush();
                    _docResponse.Close();

                    //Prepare form for authentication as _rtcAuthHeader = authrequired
                    HttpWebRequest _formPost = (HttpWebRequest)WebRequest.Create(_rtcServerURL + "/j_security_check");
                    _formPost.Method = "POST";
                    _formPost.Timeout = 30000;
                    _formPost.AutomaticDecompression = DecompressionMethods.None;
                    _formPost.CookieContainer = _request.CookieContainer;
                    _formPost.Accept = "text/xml";
                    _formPost.ContentType = "application/x-www-form-urlencoded";

getting Bad request error.

Kindly anyone help me to get this resolved.


Comments
Ulf Arne Bister commented Dec 13 '17, 4:24 a.m.

Wrong Forum. ClearQuest is not part of Jazz Technology so you will have to contact IBM Support directly for this.

The question has been closed for the following reason: "Question is off-topic or not relevant" by rschoon Dec 13 '17, 5:39 a.m.