Forum Discussion

ernschd's avatar
ernschd
Frequent Visitor
4 years ago

Webservice ist not working like expected

Hello,

 

our working group has created a web service in OpenAPI 3.0.0: https://arge-heiwako.de/wp-content/uploads/2020/10/webservice-arge-heiwako-1.0.zip

 

So I generated a Spring server from the YAML using the Swagger editor.
Then, using Maven (3.6.3) and Java 8, I created the build (mvn.cmd clean package).
I started it with

 

mvn spring-boot:run

 

So far everything works.

Now when I send an HTTP post with XML data, I get two warnings and the data is not saved:

 

2021-02-23 09:40:31.656  WARN 13556 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/xml;charset=UTF-8' not supported]
2021-02-23 09:40:31.700  WARN 13556 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

 

 

If I send the HTTP post with JSON data, the warnings are as follows:

2021-02-23 09:47:55.167  WARN 13556 --- [nio-8080-exec-7] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type `byte[]` from String "": Unexpected end of base64-encoded String: base64 variant 'MIME-NO-LINEFEEDS' expects padding (one or more '=' characters) at the end; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `byte[]` from String "": Unexpected end of base64-encoded String: base64 variant 'MIME-NO-LINEFEEDS' expects padding (one or more '=' characters) at the end
 at [Source: (PushbackInputStream); line: 1, column: 12] (through reference chain: io.swagger.model.DocumentIn["content"])]
2021-02-23 09:47:55.182  WARN 13556 --- [nio-8080-exec-7] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

Do we have a bug in the web service? Or is it because of the swagger codegen?

 

Thank you very much in advance.

 

Best regards
Sven

 

 

No RepliesBe the first to reply