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

OSCL--cannot return JSON representation

Hi,
I create a query and represent it in a URL, https://nsjazz.raleigh.ibm.com:8002/jazz/oslc/projectareas?oslc_cm.query=dc:title=%22Mashup%20Center%22&oslc_cm.properties=rdf:resource.

Assuming the URL is stored in variable url, I execute the following:

HttpGet getMethod = new HttpGet(url);
getMethod.addHeader("Content-Type", "application/json");
getMethod.addHeader("Accept", "text/json");
httpClient.execute(getMethod);


I then get the response as follows:


InputStream is = httpResponse.getEntity().getContent();
String json = convertStreamToString(is);


However, the response (stored in variable json), is not in json format. I've tried using different resource formats such as rdf, xml, etc. but each time I get the same result. Is there something that I'm missing or need to do?

Any help is appreciated. Below is the value of my json variable after getting the response.


<html>
<head>
<meta>
<meta>
<title></title>

<link>
<link>

<style>
#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;
}
</style>

</head>

<body>
<noscript><div>Javascript is either disabled or not available in your

Browser</div></noscript>
<div>Loading...</div>
<div></div>

<script>
djConfig = {
isDebug: false,
usePlainJson: true,
baseUrl: "/jazz/web/dojo/",
locale: "en-us",
localizationComplete: true
};
/*null*/
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/jazz";
net.jazz.ajax._webuiPrefix = "/web/";
</script>

<script></script>


<script>
/* <CDATA> */
</script>

<script>
/* <CDATA> */
</script>
</body>
</html>

0 votes



One answer

Permanent link
Matthew,

Are you already authenticated ? This looks like it may be the challenge form auth part.

This could be part of your snippet that you are leaving out but generally you need to get a secure resource, this will challenge you for auth, then you authenticate based on the challenge, and then you are ready to actually get a secure resource.

https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Appendix_A

-Sean

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
× 10,940

Question asked: Feb 17 '12, 3:02 p.m.

Question was seen: 5,610 times

Last updated: Feb 17 '12, 3:02 p.m.

Confirmation Cancel Confirm