(Enterprise) Sign API upload to SDS invalid-upload-document

Hi,

I’m currently developing a java client for the Enterprise Sign API using the provided OpenAPI spec and the “Java electronic signatures quick start guide”. I get the following response:

{"instance":"/sign/documents","method":"POST","status":400,"type":"base:invalid-upload-document","title":"Cannot open or read supplied PDF","violations":[]}

Initially I tried with just a very simple PDF, but even the provided sample contract yields the same response.

Any known issues with the preprod environment, or any logs that could provide some better feedback?

EDIT: My implementation differs from the sample project, in the sense that I use the native java http client (instead of jersey), and I use gradle with its plugin to generate from oas3.

I have debugged a bit, and can’t for the life of me figure out what’s different. I even added UA header, that seems to be setup by the jersey generator.

EDIT 2: Seems like the native java http client is the issue. It may be configuration, I’m not really sure, but I did move to the jersey2 library for now. Although It’s really inconvenient with just another dependency to keep up-to-date.

EDIT 3: It’s definitely related to the native java client. Seems like first of all the auto-generated code defaults to using HttpRequest.BodyPublishers.ofByteArray and HttpResponse.BodyHandlers.ofInputStream. Even if you re-implement the upload method to use HttpRequest.BodyPublishers.ofFile the default for the get method is breaking in the jackson deserializer.

com.fasterxml.jackson.core.JsonParseException: Unexpected character (’%’ (code 37)): expected a valid value (JSON String, Number, Array, Object or token ‘null’, ‘true’ or ‘false’)

Hi, it seems that your content-type somehow gets set to JSON and that is causing issues.