Skip to content

Instantly share code, notes, and snippets.

@marco-mendes
Created May 28, 2017 20:34
Show Gist options
  • Save marco-mendes/0127cd8f3601da2ef592b0448e412094 to your computer and use it in GitHub Desktop.
Save marco-mendes/0127cd8f3601da2ef592b0448e412094 to your computer and use it in GitHub Desktop.
@Endpoint
public class CountryEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
private CountryRepository countryRepository;
@Autowired
public CountryEndpoint(CountryRepository countryRepository) {
this.countryRepository = countryRepository;
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getCountryRequest")
@ResponsePayload
public GetCountryResponse getCountry(@RequestPayload GetCountryRequest request) {
GetCountryResponse response = new GetCountryResponse();
response.setCountry(countryRepository.findCountry(request.getName()));
return response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment