About creating RTC WI with OSLC
Hello.
I need to create a java client that can talk with RTC (4.0.1) via OSLC, to create/read/update WI.
I started with installing the OSLC4J 1.1. project (eclipse lyo),and running the RTCFormSample provided with it.
WIs query and update work fine, but the "create" of a ChangeRequest (WI) fails.
To be more exact, it simply doesn't work, since it does not throw any exception/error.
The code in the sample is:
//Create the change request
ClientResponse creationResponse = client.createResource(
changeRequestCreation, changeRequest,
OslcMediaType.APPLICATION_RDF_XML,
OslcMediaType.APPLICATION_RDF_XML);
String changeRequestLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION);
You can realize that "create" fails since the "changeRequestLocation" is null.
I have debugged a little bit the code, and I found that the ClientResponse fields "status" and "message" are respectively "403" and "forbidden".
Since I'm quite sure that credentials are correct, and they are allowed to create a WI (I've verified from RTC WUI), have you any idea what could be the problem?
Could it be the version of the OSLC libraries?
thanks in advance
I need to create a java client that can talk with RTC (4.0.1) via OSLC, to create/read/update WI.
I started with installing the OSLC4J 1.1. project (eclipse lyo),and running the RTCFormSample provided with it.
WIs query and update work fine, but the "create" of a ChangeRequest (WI) fails.
To be more exact, it simply doesn't work, since it does not throw any exception/error.
The code in the sample is:
//Create the change request
ClientResponse creationResponse = client.createResource(
changeRequestCreation, changeRequest,
OslcMediaType.APPLICATION_RDF_XML,
OslcMediaType.APPLICATION_RDF_XML);
String changeRequestLocation = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION);
You can realize that "create" fails since the "changeRequestLocation" is null.
I have debugged a little bit the code, and I found that the ClientResponse fields "status" and "message" are respectively "403" and "forbidden".
Since I'm quite sure that credentials are correct, and they are allowed to create a WI (I've verified from RTC WUI), have you any idea what could be the problem?
Could it be the version of the OSLC libraries?
thanks in advance
2 answers
Hi Pietro,
try to check the body of the ClientResponse. RTC usually provides additional error messages there, similar to this one:
Oliver
try to check the body of the ClientResponse. RTC usually provides additional error messages there, similar to this one:
<oslc:Error> <oslc:message>Unexpected identifier "asdf": line 1, column 6</oslc:message> <oslc:statusCode>400</oslc:statusCode> </oslc:Error>Hope that helps,
Oliver