Using RPC-JSON to modify an existing documents always fails with "JSON parse error"

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

Hi @thomas-soft-grove,

I think the issue is with this line:

Default serialization for DocumentRefference is creating a json structure which is not acceptable by json-rpc server

"docRef": {
        "docRef": "AntrVerbindlicheAuskunft_1/788"


Please change this line to

putParameter("docRef", docRef.toString()).

and it should work. We are sorry about the lack of messages for (de)serialization of requests. There are 2 reasons why the messages are so poor here:

  1. We are using many different deserializers for different aspects of the requests (JSON-RCP wrapper), SPeL deserializer, A12 Kernel deserializer, Data Services deserializer,…) and it is hard to coordinate between them with proper exception handling, when we want to provide consistent and unified error messages that our client can always read. For this we use wrappers that often hide the problem
  2. The security audits prevent us from logging any document relevant data into the logs because that data can be subject to GDPR.

Therefore, our logging capabilities are quite limited in this area. Please create a ticket for improvement in that area and we will take a further look and maybe we can log at least some request metadata or serializer name

Thanks, that works. I knew it must have been something stupid.

In this specific case a message like “Invalid docRef” would have been helpful I guess (which doesn’t seem problematic with regards to security or GDPR)

The issue here is not GDPR but our many deserializers which makes it hard for us to know where the origin or parse error is. Spring parser does not know the contents of json-rpc serializer and this one does not know that inside some json-rpc methods are properties that are deserialized with another serializer