[Closed] RQM: Authentication issue with OSLC coding
Hello,
I am trying to read RQM data using OSLC rest api. its reading an error message in text/html type. (I am not able to post it here) For me It looks to be authentication problem. it Reports - "Java script is either disabled or not available in your Browser". I have taken care of all the settings required in the browser & Java, still I am getting the same error. I am able to read the root services which doesn't needs login but for other services which needs login, I get the above error. I am able to read the data from REST CLIENT and I have authentication problem only with JAVA. Can any one help me to solve this issue. Thanks in advance |
Accepted answer
Please read the documentation carefully and place an equality sign between option and value: -qm=https://internalserver.com:443/qm/ Kumar Kumar selected this answer as the correct answer
Comments
Kumar Kumar
commented Jun 07 '16, 1:59 a.m.
I tried the same -qm=https://internalserver.com:443/qm/ Reported below error : SEVERE: java.lang.IllegalArgumentException: -qualityManagerURL requires a valid IBM Rational Quality Manager server URL java.lang.IllegalArgumentException: -qualityManagerURL requires a valid IBM Rati onal Quality Manager server URL at com.ibm.rqm.api.APIUtility.main(APIUtility.java:173) RQM API Utility has terminated due to an error. Note: same path I am able to open it in browser. I tried with the space: -qm = https://internalserver.com:443/qm/ Got the same error as previous : -qualityManagerURL requires a value
Kumar Kumar
commented Jun 07 '16, 3:39 a.m.
Its working I had missed -o at the end. Now I need to find the better way to extract the test cases from specific Test plans. Thanks, I tried the same code in commandline through Java - It literally hangs, String[] cmd = { javapath, "-jar","C:\Users\cra6kor\Downloads\RQMAPIUtility\RQMAPIUtility.jar","-c=findProjectsWithRequirements","-qm=https://internalserver.com:443/qm","-u='username'","-pw=password","-o"}; Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); InputStream stdin = p.getInputStream(); InputStreamReader isr = new InputStreamReader(stdin); BufferedReader br = new BufferedReader(isr); String line = null; System.out.println(" <output> "); while ( (line = br.readLine()) != null) System.out.println(line); </output> |
One other answer
You are probably seeing the HTML login page for RQM, if you haven't authenticated correctly with the RQM server. You can use the authentication code (com.ibm.rqm.cleaner.internal.client.JazzHttpClient.login(Credential)) from the OSLC Cleaner Utility.
Comments
Kumar Kumar
commented Jun 03 '16, 1:04 a.m.
I don't see the option login.
If you are using the OSLC Cleaner Utility, you need to specify your credentials on the command line (see the readme.txt).
Kumar Kumar
commented Jun 06 '16, 4:41 a.m.
I tried with the commandline as mentioned in the readme.txt
As noted in the error message, you need to specify a value for the -qualityManagerURL argument. Please see the readme.txt. In the readme.txt :
Kumar Kumar
commented Jun 07 '16, 1:03 a.m.
I am bit confused with the RQM authentication. I am able to access through HttpRequester, Rest api client but if I try the Http request with Java code, reports an error - "Javascript is either disabled or not available in your Browser". Now I am trying the same with commandline still I get the problem with qm value. which one is a working format, Httprequest or RQMUtility with commandline is a big question for me?
Donald Nong
commented Jun 07 '16, 1:36 a.m.
When you develop your own code, you need to be mindful with the HTTP headers. If you use other tools or browsers, they send some particular HTTP headers by default. If you keep getting the text/html format response, it is probable that you have not sent the correct HTTP header to the RQM server. Refer to the below document for details about the HTTP headers.
Kumar Kumar
commented Jun 07 '16, 2:10 a.m.
Hello, I have followed it as it is, below is my code this.rqmHost = new HttpHost("internalserver.com", 443 , "https"); UsernamePasswordCredentials creds = new UsernamePasswordCredentials( "username", "password"); this.context = HttpClientContext.create(); HttpGet rootServiceDoc = new HttpGet("/qm/oslc_qm/catalog"); rootServiceDoc.addHeader("OSLC-Core-Version", "2.0"); rootServiceDoc.addHeader("Content-Type", "application/rdf+xml"); rootServiceDoc.addHeader("Accept", "application/rdf+xml"); rootServiceDoc.addHeader(BasicScheme.authenticate(creds,"UTF-8",false)); HttpClient httpclient = new DefaultHttpClient(); HttpUtils.setupLazySSLSupport(httpclient); rootServiceResponse = httpclient.execute(this.rqmHost, rootServiceDoc, this.context); Kindly let me know if you found something missing. Your argument (-qm "https://internalserver.com:443/") has two issues:
-No equals sign.
-No context root.
The correct argument is:
-qm="https://internalserver.com:443/qm"
See the Usage Examples in the readme.txt.
Your code looks fine from a REST perspective, but your not handling the authentication with the RQM server. Please see the com.ibm.rqm.cleaner.internal.client.JazzHttpClient.login(Credential) method from the OSLC Cleaner Utility source.
Kumar Kumar
commented Jun 07 '16, 10:24 p.m.
com.ibm.rqm.cleaner.internal.client.JazzHttpClient.login(Credential) can't be used directly as login is a protected method inside the abstract class JazzHttpClient in RQMAPIUtility.jar. I have extended my class to use it. Please see my main functioncode below, serverUrl = new URL("https://internalserver:443/qm"); testplan_ver2 d= new testplan_ver2(serverUrl); d.login(credential); HttpResponse rootServiceResponse = Connection.INSTANCE.executeGetService(); if (rootServiceResponse.getStatusLine().getStatusCode() != 200) { EntityUtils.consume(rootServiceResponse.getEntity()); throw new HttpResponseException(rootServiceResponse.getStatusLine().getStatusCode(), rootServiceResponse.getStatusLine().getReasonPhrase()); } } It reports the below error: Unable to create SSL_TLS context, trying SSLv3 Exception in thread "main" java.lang.NullPointerException at com.ibm.rqm.cleaner.internal.client.JazzHttpClient.fixMethodHeader(JazzHttpClient.java:249) could you please let me know what is missing in my code Chethan, you need to debug your Java code to determine the root cause of this exception. I debugged it,
Donald Nong
commented Jun 08 '16, 10:43 p.m.
You set the request headers before making a request. The server sets the response headers before sending the response back. Do you set the request headers at all anywhere in your code?
I have set the Header had missed the function: Map<String, String> getRequestHeaders();
showing 5 of 15
show 10 more comments
|
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.