https://localhost:9443/jts/process/project-areas
I'm trying to use this REST webservice, but I'm not sure what I should use as Content-Type and Accept in the request header.
If I'm using it without any request header, then I get the php code of the homepage back. So how can I check what request header I should set?
In this document, it is mentioned application/xml, but that doesnt improve the situation.
https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#GET_project_areas_collection
If I'm using it without any request header, then I get the php code of the homepage back. So how can I check what request header I should set?
In this document, it is mentioned application/xml, but that doesnt improve the situation.
https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#GET_project_areas_collection
8 answers
Hello,
This is what we use in the tests for that service:
Content-Type is application/xml;charset=UTF-8
Accept-Charset is UTF-8
Accept is application/xml
Regards,
Martha
This is what we use in the tests for that service:
Content-Type is application/xml;charset=UTF-8
Accept-Charset is UTF-8
Accept is application/xml
Regards,
Martha
I'm trying to use this REST webservice, but I'm not sure what I should use as Content-Type and Accept in the request header.
If I'm using it without any request header, then I get the php code of the homepage back. So how can I check what request header I should set?
In this document, it is mentioned application/xml, but that doesnt improve the situation.
https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#GET_project_areas_collection
Thanks for your answer. I tried everthing that you suggested, but I still don't get the correct result:
This generates the following result:
But if I use a REST Client plugin for firefox, I get the correct results with the same headers.
I can't see an error in my code.
public void getRootService() throws ClientProtocolException, IOException {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("https://localhost:9443/ccm/rootservices");
httpGet.setHeader("Accept", "text/xml");
HttpResponse response = client.execute(httpGet, localContext);
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
String projectURL = XMLDocumentParser.parseDocument(in);
System.out.println(projectURL);
HttpGet getProjectsRequest = new HttpGet(projectURL);
getProjectsRequest.setHeader("Content-Type", "application/xml, charset=UTF-8");
getProjectsRequest.setHeader("Accept-Charset", "UTF-8");
getProjectsRequest.setHeader("Accept", "application/xml");
ResponseHandler<String> handler = new BasicResponseHandler();
String projectResponse = client.execute(getProjectsRequest, handler, localContext);
System.out.println(projectResponse);
}
This generates the following result:
{
"userId": "TestUser",
"roles": [
"JazzUsers",
"JazzAdmins"]
}
But if I use a REST Client plugin for firefox, I get the correct results with the same headers.
I can't see an error in my code.
Thanks for your answer. I tried everthing that you suggested, but I still don't get the correct result:
This generates the following result:
{
"userId": "TestUser",
"roles": [
"JazzUsers",
"JazzAdmins"]
}
This response looks like the json response to a user query. Are you sure the projectURL returned from the xml parser is like this: https://localhost:9443/jts/process/project-areas?
Dancy
Thanks for your answer. I tried everthing that you suggested, but I still don't get the correct result:
This generates the following result:
{
"userId": "TestUser",
"roles": [
"JazzUsers",
"JazzAdmins"]
}
This response looks like the json response to a user query. Are you sure the projectURL returned from the xml parser is like this: https://localhost:9443/jts/process/project-areas?
Dancy
Yes I am sure. If I test this URL with a REST plugin for firefox it returns the correct XML document.
Yes I am sure. If I test this URL with a REST plugin for firefox it returns the correct XML document.
Can you try to get the status code? And have you passed the authentication?
The status Code is 200. And I think that I have passed the authentication.
I have the following cookies after the authentication:
JSESSIONID : 5AB83AF30B70DDC12F8583541C8A393E
JazzFormAuth : Form
And this is the header of the subsequent test GET to the REST:
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONIDSSO=9A492E254F51CCC6DDF0A69CB5EE4D57; Path=/; Secure
Set-Cookie: X-com-ibm-team-foundation-auth-loop-avoidance=false
Content-Type: text/json;charset=utf-8
Content-Length: 76
Date: Tue, 11 Oct 2011 15:44:07 GMT
Hello,
I am not sure if it matters, but our tests are also setting a header named
X-com-ibm-team-userid to the user id.
Martha
Can you try to get the status code? And have you passed the authentication?
The status Code is 200. And I think that I have passed the authentication.
I have the following cookies after the authentication:
And this is the header of the subsequent test GET to the REST:
I am not sure if it matters, but our tests are also setting a header named
X-com-ibm-team-userid to the user id.
Martha
Yes I am sure. If I test this URL with a REST plugin for firefox it returns the correct XML document.
Can you try to get the status code? And have you passed the authentication?
The status Code is 200. And I think that I have passed the authentication.
I have the following cookies after the authentication:
JSESSIONID : 5AB83AF30B70DDC12F8583541C8A393E
JazzFormAuth : Form
And this is the header of the subsequent test GET to the REST:
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONIDSSO=9A492E254F51CCC6DDF0A69CB5EE4D57; Path=/; Secure
Set-Cookie: X-com-ibm-team-foundation-auth-loop-avoidance=false
Content-Type: text/json;charset=utf-8
Content-Length: 76
Date: Tue, 11 Oct 2011 15:44:07 GMT
Yes I am sure. If I test this URL with a REST plugin for firefox it returns the correct XML document.
Can you try to get the status code? And have you passed the authentication?
The status Code is 200. And I think that I have passed the authentication.
I have the following cookies after the authentication:
JSESSIONID : 5AB83AF30B70DDC12F8583541C8A393E
JazzFormAuth : Form
And this is the header of the subsequent test GET to the REST:
Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONIDSSO=9A492E254F51CCC6DDF0A69CB5EE4D57; Path=/; Secure
Set-Cookie: X-com-ibm-team-foundation-auth-loop-avoidance=false
Content-Type: text/json;charset=utf-8
Content-Length: 76
Date: Tue, 11 Oct 2011 15:44:07 GMT
Have you tried setting these cookies in the request header? I don't see this in your code. And you may need to pass SSO session id as well.
Dancy