Could not write request: no suitable HttpMessageConverter found for request type and content type [application/x-java-serialized-object]

前端 未结 1 945
眼角桃花
眼角桃花 2021-01-17 00:56

I am trying to post an xml request to a third party server and expecting an xml response back.

I am here by attaching the source code for configuring Cnfiguration,ga

1条回答
  •  抹茶落季
    2021-01-17 01:50

    Finally i found solution by setting header enricher out put channel to be passed as request channel to httpoutbound gateway. Find below code snippet,there i set content-type to application/xml that resolves problem.

    @Bean
    @Transformer(inputChannel = "RequestChannel", outputChannel = "enricherOutputChannel")
    public HeaderEnricher makeEnricher() {
    
        Map> headersToAdd = Collections
            .singletonMap(HttpHeaders.CONTENT_TYPE, new StaticHeaderValueMessageProcessor<>("application/xml"));
    
        HeaderEnricher enricher = new HeaderEnricher(headersToAdd);
        enricher.setDefaultOverwrite(true);
    
        return enricher;
    }
    

    0 讨论(0)
提交回复
热议问题