Created
July 15, 2015 07:42
-
-
Save KomanRudden/eaa5df24c96b7c1b345f to your computer and use it in GitHub Desktop.
Apache CXF JAX-RS Client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<JacksonJsonProvider> providers = new ArrayList<>(); | |
JacksonJsonProvider provider = new JacksonJsonProvider(); | |
provider.addUntouchable(Response.class); | |
providers.add(provider); | |
WebClient client = WebClient.create("http://<hostname>/path/to/service", providers); | |
client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON); | |
client.post(myCustomDTO); | |
//MyCustomDTO will be an object (basic POJO) that can be JSON'd as required | |
<--Maven Dependencies--> | |
<dependency> | |
<groupId>org.apache.cxf</groupId> | |
<artifactId>cxf-rt-rs-client</artifactId> | |
<version>3.0.0-milestone1</version> | |
</dependency> | |
<dependency> | |
<groupId>com.fasterxml.jackson.jaxrs</groupId> | |
<artifactId>jackson-jaxrs-json-provider</artifactId> | |
<version>2.5.4</version> | |
</dependency> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment