Good day,
I need to call a third party, REST Api with XML.
I am using Spring WebCLient to call.
I got set the content type with
<code>headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE);
</code>
<code>headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE);
</code>
headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML_VALUE);
the request object i pass in also is JAXBElement<MyObject>
.
I also got try put in the decoder in my WebClient.Builder
:
<code>.codecs(configurer -> {
configurer.defaultCodecs().jaxb2Encoder(new Jaxb2XmlEncoder());
configurer.defaultCodecs().jaxb2Decoder(new Jaxb2XmlDecoder());
})
</code>
<code>.codecs(configurer -> {
configurer.defaultCodecs().jaxb2Encoder(new Jaxb2XmlEncoder());
configurer.defaultCodecs().jaxb2Decoder(new Jaxb2XmlDecoder());
})
</code>
.codecs(configurer -> {
configurer.defaultCodecs().jaxb2Encoder(new Jaxb2XmlEncoder());
configurer.defaultCodecs().jaxb2Decoder(new Jaxb2XmlDecoder());
})
However, I am still hitting the same error.
My Spring Web version is 6.1.5,
and my jakarta.xml.bind
version is 4.0.2.
I stuck in this for whole day, anyone can advise or giving any clue on this?
1