I'm trying to use CXF REST services to allow the user to change their own
password. I'm using the Jersey REST client. Using GET with "/users/self"
works. However, I'm getting a either a 404 or 500 error from Syncope when
I try to POST to "/users/100" or "/users/self". (In this case, the user's
ID is "100".)
What am I doing wrong?
-Nathan
URI baseUri = UriBuilder.fromUri("https://my-server/syncope/cxf").build()
ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
client.addFilter(new HTTPBasicAuthFilter(username, oldPassword));
WebResource service = client.resource(baseUri);
// this part works
ClientResponse response = service.path("users").path("self"
).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
String s = "{\"password\":\""+newPassword+"\"}";
// this gives a 404 error
ClientResponse response2 = service.path("users").path("100")
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.post(ClientResponse.class,s);
// this gives a 500 error
ClientResponse response3 = service.path("users").path("self")
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.post(ClientResponse.class,s);