Log In
Developer Network
Technologies
Join the Network
Member Services
Events & Community
Unity Connection(CUC) Developer Center
Overview
Documentation
Community
CUC Forums
Message Boards Home
Recent Posts
Statistics
Answer
(
Unmark
)
Mark as an Answer
« Back to CUPI Questions
Trying to Reset PIN returns 415 response code
Threads [ Previous | Next ]
kapil khanna
Posts:
0
Join Date:
5/17/11
Recent Posts
Trying to Reset PIN returns 415 response code
Answer
6/9/11 9:43 PM
Mark as an Answer
Submit
Reply with Quote
Quick Reply
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);
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
kapil khanna
Posts:
0
Join Date:
5/17/11
Recent Posts
RE: Trying to Reset PIN returns 415 response code
Answer
6/9/11 10:14 PM as a reply to kapil khanna.
Mark as an Answer
Submit
Reply with Quote
Quick Reply
Come to find out, the server is expecting application/xml and not text/xml as the content type. Replacing it fixed the issue.
Sign in to vote.
Flag
Please sign in to flag this as inappropriate.
Top
Overview
Documentation
Community