This document was generated from CDN thread
Created by: kapil khanna on 09-06-2011 04:43:53 PM
I am trying to reset a User's Pin by call the Http PUT method on the URI of the form
/vmrest/users/<objectId>/credential/pin
<?xml version="1.0" encoding="UTF-8" standalone="yes">
<Credential>
<Credentials>112233</Credentials>
</Credential>
The error message I am getting is the following:
The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().
How does the request need to be formatted for the server? I was not able to find any documentation to that effect.
I am using the apache HttpClient and not really doing anything off the cuff:
HttpPut put = new HttpPut(url);
StringEntity requestEntity = new StringEntity(request,HTTP.UTF_8); //request is the xml string posted above
requestEntity.setContentType("text/xml");
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(
username, password);
put.addHeader(BasicScheme.authenticate(credentials, "US-ASCII",
false));
put.addHeader("Content-Type","text/xml;charset=UTF-8");
put.setEntity(requestEntity);
HttpResponse response = client.execute(put);
Subject: RE: Trying to Reset PIN returns 415 response code
Replied by: kapil khanna on 09-06-2011 05:14:15 PM
Come to find out, the server is expecting application/xml and not text/xml as the content type. Replacing it fixed the issue.