We are trying to modify an existing document through the JSON RPC interface using JsonRpc2RequestBuilder.
The document that I want to save is retrieved through a LIST_DOCUMENT operation.
The list operation returned this:
{
"fullSize" : 1,
"page" : {
"offset" : 0,
"limit" : 1
},
"entries" : [ {
"docRef" : "AntrVerbindlicheAuskunft_1/788",
"documentModelName" : "AntrVerbindlicheAuskunft_1",
"document" : {
"id" : "-1",
"Cockpit" : {...},
"AntrVerbAus" : {...}
}
} ]
}
Then the JsonNode below “document” is extracted and modified. That JsonNode is then sent back to the BAP server, so it looks something like this:
The Java code looks like this:
JsonRpc2RequestBuilder builder = requestBuilderFactory.newJsonRpc2RequestBuilder();
builder.addMethodCall(CoreOperationConstants.MODIFY_DOCUMENT_OPERATION).
id("save_" + docRef.toString()).
putParameter("docRef", docRef).
putParameter("locale", Locale.GERMAN).
putParameter("document", newDocument);
List<JsonRpc2Response> results = rpcOperationsClient.invoke(builder.build());
The docRef is the original docRef returned from the LIST operation. newDocument contains the modified document which looks like this:
{
"id" : "-1",
"Cockpit" : {...},
"AntrVerbAus" : {...}
}
But the call always returns the (not very helpful) error “JSON parse error” without any details. The log file of the BAP Server shows no message at all (even though log level for the data services as been set to DEBUG). I tried setting the "id" to the correct value and remove the "id" attribute but to no avail.
What am I missing here? How can I get a better (more descriptive) error message than “JSON parse error” to find the error in the document (or in the way I pass it)?
Do I need to pass the document in a different format? The manual only states that the parameter “document” should contain the document.
Our A12 Services version is 32.2