【发布时间】:2018-11-02 17:02:27
【问题描述】:
我正在使用 WebClient (SpringBoot 2.0.2.RELEASE) 发送带有 SOAP 请求的 POST,但它缺少所需的“Content-Length”标头旧版 API。
是否可以将 WebClient 配置为包含“Content-Length”标头? 在 SpringBoot 2.0.1 中为 EncoderHttpMessageWriter 解析并引入了 Spring Framework Issue,但它似乎不适用于 JAXB。
我尝试使用BodyInserters:
webClient.post().body(BodyInserters.fromObject(request)).exchange();
和syncBody:
webClient.post().syncBody(request).exchange();
他们都没有为WebClient工作。但是,当使用RestTemplate 时,Content-Length 已设置并且 API 响应成功
【问题讨论】:
标签: spring-boot spring-webflux