CLM 5.0.2 , trying to connect to RQM using the HTTP query and it is not returning the XML rather a html file
The code we are using to connect RQM are -
1. Login - We get no error
public int login(String userid, String password) {
this.userid = userid;
this.password = password;
int code = 0;
try {
httpclient.registerTrustingSSL();
int ret = httpclient.login(userid, password);
if (ret == HttpURLConnection.HTTP_UNAUTHORIZED) {
System.out.println("RQMUrlUtility: Cannot authenticate to server for user "
+ userid);
code = -1;
} else if (ret == HttpURLConnection.HTTP_CLIENT_TIMEOUT) {
System.out.println("RQMUrlUtility: Timeout authenticating to server for user "
+ userid);
code = -1;
}
} catch (Exception e) {
System.out.println("RQMUrlUtility: Cannot authenticate to server " + e);
code = -1;
}
return code;
}
}
then http query to get a test plan
Request Parameters -
USername, password, query URL
This is the query we are using to get a Test Plan-
https://<host>:<port>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Area>/testplan
The code snippet to do the GET is:
RQMUrlUtlyLogin.getHttpClient().fixMethodHeader(method);
/*
* Check for the Server Response for the GET Operation
*/
int responseCode = RQMUrlUtlyLogin.getHttpClient().executeMethod(
method);
if (responseCode != HttpStatus.SC_OK) {
System.err.println("RQMUrlUtility: Method failed: "
+ method.getStatusLine());
return;
}
System.out.println("RQMUrlUtility: Server Response code: " + responseCode);
if (responseCode<400)
{
// Read the responseCode body.
byte[] responseBody = method.getResponseBody();
BufferedWriter out = new BufferedWriter(new FileWriter(
sPath));
out.write(new String(responseBody));
out.close();
System.out
.println("RQMUrlUtility: [ SUCESS ] XML string retrieved from URL : \""
+ sAttachURL
+ " \" is written to file located at -: \" "
+ sPath + " \"");
}
}
This worked fine until version 5.0.1.
Is there any suggestion as to how to make it work for 5.0.2?
1. Login - We get no error
public int login(String userid, String password) {
this.userid = userid;
this.password = password;
int code = 0;
try {
httpclient.registerTrustingSSL();
int ret = httpclient.login(userid, password);
if (ret == HttpURLConnection.HTTP_UNAUTHORIZED) {
System.out.println("RQMUrlUtility: Cannot authenticate to server for user "
+ userid);
code = -1;
} else if (ret == HttpURLConnection.HTTP_CLIENT_TIMEOUT) {
System.out.println("RQMUrlUtility: Timeout authenticating to server for user "
+ userid);
code = -1;
}
} catch (Exception e) {
System.out.println("RQMUrlUtility: Cannot authenticate to server " + e);
code = -1;
}
return code;
}
}
then http query to get a test plan
Request Parameters -
USername, password, query URL
This is the query we are using to get a Test Plan-
https://<host>:<port>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<Project Area>/testplan
The code snippet to do the GET is:
RQMUrlUtlyLogin.getHttpClient().fixMethodHeader(method);
/*
* Check for the Server Response for the GET Operation
*/
int responseCode = RQMUrlUtlyLogin.getHttpClient().executeMethod(
method);
if (responseCode != HttpStatus.SC_OK) {
System.err.println("RQMUrlUtility: Method failed: "
+ method.getStatusLine());
return;
}
System.out.println("RQMUrlUtility: Server Response code: " + responseCode);
if (responseCode<400)
{
// Read the responseCode body.
byte[] responseBody = method.getResponseBody();
BufferedWriter out = new BufferedWriter(new FileWriter(
sPath));
out.write(new String(responseBody));
out.close();
System.out
.println("RQMUrlUtility: [ SUCESS ] XML string retrieved from URL : \""
+ sAttachURL
+ " \" is written to file located at -: \" "
+ sPath + " \"");
}
}
This worked fine until version 5.0.1.
Is there any suggestion as to how to make it work for 5.0.2?
One answer
<pre>
<!DOCTYPE html>
<!--
Licensed Materials - Property of IBM
(c) Copyright IBM Corporation 2005-2013. All Rights Reserved.
Note to U.S. Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
-->
<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=10">
<title></title>
<link type="text/css" rel="stylesheet" href="/qm/web/_style/?include=S~&etag=BBpn1CdqPU_en_US&_proxyURL=%2Fqm&ss=FyyQI">
<link rel="shortcut icon" href="/qm/web/net.jazz.ajax/jazz.ico">
<style type="text/css">
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;
}
</style>
</head>
<body class="claro">
<noscript><div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div></noscript>
<div id="net-jazz-ajax-InitialLoadMessage">Loading...</div>
<div id="net-jazz-ajax-WorkbenchRoot"></div>
<script type="text/javascript">
djConfig = {
isDebug: false,
usePlainJson: true,
baseUrl: "/qm/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/*null*/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/qm";
net.jazz.ajax._appPath = "/qm/auth/authrequired";
net.jazz.ajax._webuiPrefix = "/web/";
</script>
<script type="text/javascript" src="/qm/web/_js/?include=S~&etag=BBpn1CdqPU_en_US&_proxyURL=%2Fqm&ss=FyyQI&locale=en-us"></script>
<script type="text/javascript">
require("dojo/main").getObject('jazz.core.loader', true)._serverStartup="FyyQI";
require("dojo/main").getObject('jazz.core.loader',true)._loaded=["S"];
</script>
<script type="text/javascript">
/* <![CDATA[ */
dojo.addOnLoad( function() {
net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired");
});
/* ]]> */
</script>
</body>
</html>
</pre>
<!DOCTYPE html>
<!--
Licensed Materials - Property of IBM
(c) Copyright IBM Corporation 2005-2013. All Rights Reserved.
Note to U.S. Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
-->
<html >
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=10">
<title></title>
<link type="text/css" rel="stylesheet" href="/qm/web/_style/?include=S~&etag=BBpn1CdqPU_en_US&_proxyURL=%2Fqm&ss=FyyQI">
<link rel="shortcut icon" href="/qm/web/net.jazz.ajax/jazz.ico">
<style type="text/css">
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;
}
</style>
</head>
<body class="claro">
<noscript><div id="net-jazz-ajax-NoScriptMessage">Javascript is either disabled or not available in your Browser</div></noscript>
<div id="net-jazz-ajax-InitialLoadMessage">Loading...</div>
<div id="net-jazz-ajax-WorkbenchRoot"></div>
<script type="text/javascript">
djConfig = {
isDebug: false,
usePlainJson: true,
baseUrl: "/qm/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/*null*/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/qm";
net.jazz.ajax._appPath = "/qm/auth/authrequired";
net.jazz.ajax._webuiPrefix = "/web/";
</script>
<script type="text/javascript" src="/qm/web/_js/?include=S~&etag=BBpn1CdqPU_en_US&_proxyURL=%2Fqm&ss=FyyQI&locale=en-us"></script>
<script type="text/javascript">
require("dojo/main").getObject('jazz.core.loader', true)._serverStartup="FyyQI";
require("dojo/main").getObject('jazz.core.loader',true)._loaded=["S"];
</script>
<script type="text/javascript">
/* <![CDATA[ */
dojo.addOnLoad( function() {
net.jazz.ajax.ui.PlatformUI.createAndRunWorkbench("net.jazz.web.app.authrequired");
});
/* ]]> */
</script>
</body>
</html>
</pre>
Comments
Paul Slauenwhite
FORUM MODERATOR / JAZZ DEVELOPER Jan 22 '15, 6:30 a.m.Do you have the HTML file contents? Unless you did not specify the Accept = application/xml header, HTML response content generally infers an authentication issue.
Also, it appears you are reusing the RQM 5.0.1 URL Utility source code. Can you try the RQM 5.0.1 URL Utility with your RQM 5.0.2 server?
Samanwita Majumdar
Jan 22 '15, 11:33 a.m.Attaching the html output.
Where do I need to mention Accept=application/xml header.
I am trying the RQMURLUtility source code of version 5.0.1 on a RQM server 5.0.2 server. Are you suggesting something different?
Paul Slauenwhite
FORUM MODERATOR / JAZZ DEVELOPER Jan 22 '15, 11:59 a.m.If you are using the RQM URL Utility without any modifications, the Accept header will be included in the request automatically.