Javascript is either disabled or not available in your Browser

I am getting a html response instead of xml response when I am running a code to read the catalog response saying Javascript is either disabled or not available in your Browser
I get proper xml response using the same credentials on REST Client on Firefox.
CLM version used is 6.0.3
<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,
layout: "",
usePlainJson: true,
baseUrl: "/jts/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/*null*/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/jts";
net.jazz.ajax._appPath = "/jts/auth/authrequired";
net.jazz.ajax._webuiPrefix = "/web/";
</script>
Code snippet below
XPath catXpath = factory.newXPath();
catXpath.setNamespaceContext(new RRCconfigNamespaceContextMap(new String[]
{ "rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"oslc_rm","http://open-services.net/xmlns/rm/1.0/"}));
// Parse the response body to retrieve the catalog URI
InputSource source = new InputSource(rootServicesResponse.getEntity().getContent());
Node catalogNode = (Node) (catXpath.evaluate(catalogXPath, source, XPathConstants.NODE));
String serviceProvidersCatalog = catalogNode.getTextContent();
rootServicesResponse.getEntity().consumeContent();
System.out.println("serviceProvidersCatalog "+serviceProvidersCatalog);
// Setup the catalog request
HttpGet catalogDoc = new HttpGet(serviceProvidersCatalog);
//catalogDoc.addHeader("Accept", "application/rdf+xml");
//catalogDoc.addHeader("OSLC-Core-Version", "2.0");
catalogDoc.addHeader("Accept", "application/rdf+xml");
catalogDoc.addHeader("OSLC-Core-Version", "2.0");
// Access to the Service Providers catalog
HttpResponse catalogResponse = RRCconfigrHttpUtils.sendGetForSecureDocument(server, catalogDoc, login, password, httpclient,jtsServer);
RRCconfigrHttpUtils.printResponseBody(catalogResponse);
if (catalogResponse.getStatusLine().getStatusCode() == 200) {
XPath spXpath = factory.newXPath();
spXpath.setNamespaceContext(
new RRCconfigNamespaceContextMap(new String[]{"rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#","oslc", "http://open-services.net/ns/core#",
"dcterms","http://purl.org/dc/terms/","oslc_rm","http://open-services.net/xmlns/rm/1.0/"}));
// Parse the response body to retrieve the Service Provider
RRCconfigrHttpUtils.printResponseBody(catalogResponse);
Accepted answer

3 other answers

See https://jazz.net/library/article/635 and understand that a REST client embedded in the browser caries the authentication headers and cookies over.

You can also look at the source for the RQM API Utility (https://jazz.net/wiki/bin/view/Main/RqmApi#RQM_API_Utility) or OSLC Cleaner Utility (https://jazz.net/wiki/bin/view/Main/RqmOslcQmV2Api#OSLC_Cleaner_Utility).
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Mar 08 '17, 10:31 a.m.I have very few knowledge about OSLC and JavaScript, but this looks to me like you are not authenticated to the system and you basically get the JTS login page back:
net.jazz.ajax._contextRoot = "/jts";
net.jazz.ajax._appPath = "/jts/auth/authrequired";
net.jazz.ajax._webuiPrefix = "/web/";
DUm Dum
Nov 02 '18, 10:22 p.m.Were you able to solve your problem. If Yes can you please guide me how to rectify this issue.
1 vote