Тип: аннотация @ResponsePayload запрещена для этого местоположения

Я сделал конечную точку для своего приложения SOAP, и когда я сделал это:

@ResponsePayload
public GetCountryResponse getCountry(@ResponsePayload GetCountryRequest request) {
    GetCountryResponse response = new GetCountryResponse();
    response.setCountry(countryRepository.findCountry(request.getName()));
}

Этот второй @ResponsePayload в методе getCountry дает мне эту ошибку:

The annotation @ResponsePayload is disallowed for this location

это аннотация response и не должна использоваться с request

lucumt 17.04.2018 16:42
0
1
554
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

В документе ResponsePayload мы можем найти ниже:

Annotation which indicates that a method return value should be bound to the response payload. Supported for annotated endpoint methods.

ТАК, используя @RequestPayload вместо @ResponsePayload

@ResponsePayload
public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) {
    GetCountryResponse response = new GetCountryResponse();
    response.setCountry(countryRepository.findCountry(request.getName()));
}

Более подробную информацию можно найти на ResponsePayload и RequestPayload

Другие вопросы по теме