netflix feign client - RequestMethod.POST submits empty json object to service

3.1k views Asked by At

When i send a POST request using netflix client , the json properties are blank when it hits the service consumer.

Below is my interface

@FeignClient(name = "NLPService",  configuration = FooConfiguration.class )
public interface NLPServiceConsumer  extends TempInterface {    
}


public interface TempInterface {

    @RequestMapping("/greeting")
    String greeting();

    @RequestMapping(method = RequestMethod.POST,value="/nlp",
            consumes="application/json",produces="application/json")
    NLPResponse identifyTags(NLPInputToBeTransformed nlpInputToBeTransformed);

    @RequestMapping(method = RequestMethod.GET,value="/nlpGetMethod",
            produces="application/json")
    NLPResponse identifyTagsTest();


}

Method identifyTagsTest works and I am able to successfully get the response . This method is a GET method with no input

When I try a POST method , passing a object as parameter , at the end point service implementation , the object attributes are null .

Has anybody faced such issue ? Is there any mistake in my configuration ?

1

There are 1 answers

1
lives On BEST ANSWER

The problem was not at the feign client. It was at the service implementation

Spent almost a day on this issue . The RestController also has to specify @RequestBody ( apart from the shared interface )

can @FeignClient extend - and @RestController implement - a common, fully-annotated Interface?