I'm using a default connector: Receive XML on a REST endpoint.
External system is sending XML data into my connector which are encoded in UTF-8 and posted with Content-Type: application/xml header.
However no events are processed down the stream and this is logged by the GeoEvent Server:
Could not decode the incoming buffer. Expected UTF-8 encoding. Make sure your input is in UTF-8 encoding.
Input length = 1 java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(Unknown Source) ~[?:?] at java.nio.charset.CharsetDecoder.decode(Unknown Source)…
A previous version of the external system was sending XML data with Content-Type:text/xml;charset=utf-8 header and the processing was fine.
Any ideas how to overcome this issue?
It seems that the XmlInboundAdapter requires the charset definition in a Content-Type header, otherwise it will not intercept the data stream and will fail with an error "Could not decode the incoming buffer. Expected UTF-8 encoding. Make sure your input is in UTF-8 encoding.".
Examples of a Content-Type headers:
- application/xml (fail)
- application/xml; charset=utf-8 (ok)
- text/xml (fail)
- text/xml; charset=utf-8 (ok)
As the charset definition is not mandatory in the HTTP spec, the XmlInboundAdapter should accept the incoming data as utf-8 encoded also if the charset definition is missing in a header.