I am following the steps in https://jazz.net/wiki/bin/view/Main/DNGModuleApiScenario2
I have Retrieved the Module structure as JSON in a String.
Then I have PUT the same string back in the same module.
I took care of using the eTag.
When I do the PUT using a RESTClient I get this:
{
"detailedMessage": "Propagated exception; original message [InternalServerErrorException: Propagated exception; original message [RuntimeException: No supported parser for format: text\/plain]] (More info found at entry [2c67ceec6da1b3cb] in the RM application server log)",
"errorMessage": "Bad Request",
"errorStatus": "400"
}
In DNG logs:
2018-03-19 16:40:28,552 [Default Executor-thread-100365 @@ 16:40 <unauthenticated> <Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0@9.26.42.216> /rm/resources/_a7V9wSiTEei0FZBpM_jKog/structure] ERROR ibm.rdm.fronting.server.services.RMRestServiceBase - CRRRS1007E A problem occurred in the Requirements Management (RM) server: Entry [ab4899d507e71022]
com.ibm.rdm.fronting.server.exception.InternalServerErrorException: Propagated exception; original message [InternalServerErrorException: Propagated exception; original message [RuntimeException: No supported parser for format: text/plain]]
at com.ibm.rdm.fronting.server.exception.RRSException.newException(RRSException.java:271)
at com.ibm.rdm.fronting.server.exception.RRSException.newException(RRSException.java:810)
at com.ibm.rdm.fronting.server.exception.RRSException.capture(RRSException.java:814)
...
Caused by: com.ibm.rdm.fronting.server.exception.InternalServerErrorException: Propagated exception; original message [RuntimeException: No supported parser for format: text/plain]
at com.ibm.rdm.fronting.server.exception.RRSException.newException(RRSException.java:271)
at com.ibm.rdm.fronting.server.exception.RRSException.newInternalServerErrorException(RRSException.java:149)
at com.ibm.rdm.fronting.server.core.jpi.internal.InternalServiceExchange.checkError(InternalServiceExchange.java:56)
at com.ibm.rdm.fronting.server.core.jpi.internal.InternalServiceExchange.getResponse(InternalServiceExchange.java:37)
at com.ibm.rdm.fronting.server.core.spi.BaseServiceRequest.execute(BaseServiceRequest.java:118)
at com.ibm.rdm.fronting.server.core.spi.BaseServiceRequest.executeWithExchange(BaseServiceRequest.java:128)
at com.ibm.rdm.fronting.server.services.RMRestService.runInternalMethod(RMRestService.java:469)
... 59 more
Caused by: java.lang.RuntimeException: No supported parser for format: text/plain
at com.ibm.rdm.fronting.server.services.publicapi.artifact.internal.ArtifactDataBuilder.adaptInputStreamUsingContentType(ArtifactDataBuilder.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Here is a flatten version section of the code I use:
String structureURI = this.moduleURI + "/structure";
HttpGet get = new HttpGet(structureURI);
get.addHeader("DoorsRP-Request-Type", "public 2.0");
get.addHeader("Accept", "application/json");
HttpResponse responseGet = HttpUtils.sendGetForSecureDocument(clm_props.getServerURL(), get, clm_props.getCLMlogin(), clm_props.getCLMpassword(), httpclient, clm_props.getJazzURL());
if (responseGet.getStatusLine().getStatusCode() != 200) {
responseGet.getEntity().consumeContent();
throw new HttpResponseException(responseGet.getStatusLine()
.getStatusCode(), responseGet.getStatusLine()
.getReasonPhrase());
}
Header etag = responseGet.getLastHeader("etag");
this.moduleEtag = etag.getValue();
if (clm_props.getDEBUG())
System.out.println(">> moduleEtag \n" + this.moduleEtag);
String moduleStr = EntityUtils.toString(responseGet.getEntity());
responseGet.getEntity().consumeContent();
HttpPut put = new HttpPut(structureURI);
put.addHeader("DoorsRP-Request-Type", "public 2.0");
put.addHeader("Accept", "application/json");
if ( this.moduleEtag != null) {
put.addHeader("If-Match", this.moduleEtag);
}
put.setEntity(new StringEntity(moduleStr, HTTP.UTF_8));
HttpResponse responsePut = HttpUtils.sendPutForSecureDocument(clm_props.getServerURL(), put, clm_props.getCLMlogin(), clm_props.getCLMpassword(), httpclient, clm_props.getJazzURL());
responsePut.getEntity().consumeContent();
if (responsePut.getStatusLine().getStatusCode() != 202) {
throw new HttpResponseException(responsePut.getStatusLine()
.getStatusCode(), responsePut.getStatusLine()
.getReasonPhrase());
}
/* ... */
Any idea what i am missing?
A header?