RemoveThings throws Exception

Apr 3, 2009 at 9:01 PM
Hi,

I have an application that can read and write weight and blood pressure measurements from healthvault. But trying to delete or update something fails with an uncathegorized exception.
I tried this code to remove

    StringBuilder infoBuilder = new StringBuilder(256);

    infoBuilder.append("<info>");

            infoBuilder.append("<thing-id>" + thingID + "</thing-id>");

    infoBuilder.append("</info");

    Request request = new Request();

   request.setMethodName("RemoveThings");

    request.setInfo(infoBuilder.toString());

    request.setTtl(3600 * 8 + 300);  

    request.setUserAuthToken(userAuthToken);

    request.setRecordId(recordID);

    Connection con = ConnectionFactory.getConnection();

    HVAccessor accessor = new HVAccessor();

    accessor.send(request, con);

    Response response = accessor.getResponse();


shouldn't PutThings with a given <thing-id> replace an existing element? For me this throws and Exception too. My Application does have full access rights to the record.

Any clues?

Thanks

Moritz
Coordinator
Apr 4, 2009 at 1:31 AM
Hi,

You will need to include the version-stamp for the thing in order to call PutThings or RemoveThings.  The version-stamp identifies the specific version of the thing you are modifying.  You will also need to send more information about the thing itself.  A good place to start learning about the general framework of HealthVault is here:  http://msdn.microsoft.com/healthvault/default.aspx. 

You should be able to examine the response to get more information about exceptions.

--Rob