HVAccessDeniedException when updating a "thing"

Apr 25, 2011 at 10:13 PM


Using the jaxb sdk (1.2), I am trying different scenarios and I am running into the following issue with update: I am able to create a Weight record, am also able to delete Weight records but when I try t update one, I get the AccessDenied exception. Here is the piece of code that I am using to update my weight data ("theThing" in the code below):

            OverwriteThingsRequest requestInfo = new OverwriteThingsRequest();
            requestInfo.getThing().add(theThing);  // theThing is the updated record

I first get the "theThing" weight record by using the GetThingRequest and then update its value and then the above few lines tries to update the record. I checked and it seems that my application has the rights to do all sorts of things (as I mentioned, I can create and delete the same type of thing).

Is this not the correct approach to updating an existing record? Based on the documentation, it seemed that the PutThingsRequest could also be used to update a record but when I use that and pass the same update "theThing", it creates a new weight record instead of updating the existing one. Here is a piece of stacktrace in case it can be of any use:


com.microsoft.hsg.HVAccessDeniedException: The application does not have permission to call the specified method.
    at com.microsoft.hsg.DefaultResponseCodeTranslator.translate(DefaultResponseCodeTranslator.java:42)
    at com.microsoft.hsg.DefaultResponseStrategy.checkResponseCode(DefaultResponseStrategy.java:86)
    at com.microsoft.hsg.DefaultResponseStrategy.doWithResponse(DefaultResponseStrategy.java:77)
    at com.microsoft.hsg.HVAccessor$1$1.handleResponse(HVAccessor.java:94)
    at com.microsoft.hsg.URLConnectionTransport.doRequest(URLConnectionTransport.java:47)
    at com.microsoft.hsg.Connection.makeRequest(Connection.java:182)
    at com.microsoft.hsg.Connection.send(Connection.java:143)
    at com.microsoft.hsg.HVAccessor$1.send(HVAccessor.java:91)
    at com.microsoft.hsg.DefaultSendStrategy.doWithSender(DefaultSendStrategy.java:26)
    at com.microsoft.hsg.HVAccessor.send(HVAccessor.java:89)
    at com.microsoft.hsg.request.SimpleRequestTemplate.makeRequest(SimpleRequestTemplate.java:131)
    at com.microsoft.hsg.methods.jaxb.SimpleRequestTemplate.makeRequest(SimpleRequestTemplate.java:69)
    at com.microsoft.hsg.methods.jaxb.SimpleRequestTemplate.makeRequest(SimpleRequestTemplate.java:38)


Any pointer is appreciated.

Many thanks


Apr 26, 2011 at 8:31 PM
Edited Apr 26, 2011 at 9:02 PM

Hi Ali,

In addition to creating a Thing, PutThings method allows you to update a Thing.  If you call GetThings, you should be able to manipulate some fields and call PutThings with the same Thing. 

Things can evolve and as they evolve their xsd changes to reflect updates.  Each time that happens (not very often) the Thing Type Version increases.  The OverwriteThings method allows an application to replace (downgrade) an existing Thing of a newer Type Version with an older Type Version.  Doing this will lose any data only found in newer versions of the Type.

You are getting access denied because the application does not have access to the OverwriteThings method.


Apr 26, 2011 at 9:50 PM

Thank you Rob. That clarifies what the OverwriteThings does.