No Data Being Returned

Sep 20, 2012 at 5:54 PM
Edited Sep 20, 2012 at 5:55 PM

I have used the library to successfully create connection requests and view the list of users that accepted the requests and linked my application to their accounts. Now, I am trying to read medication data, but the response is "empty". By that, I mean there is XML, but there is no data in it.

I have definitely added medication to the and websites, and, when I view the medication, it states that it is shared with all of my applications. It gives me the option to make it private, but that is not selected.

I have tried both medication Thing IDs, "5c5f1223-f63c-4464-870c-3e36ba471def" and "30cafccc-047d-4288-94ef-643571f7919d". The response I am getting is:

<response><status><code>0</code></status><wc:info xmlns:wc=""><group/></wc:info></response>

Thank you for any help! It is greatly appreciated.


The code is:

Request medicationsRequest = new Request();
		"<info>" +
			// One of the types of things we are getting.
			"<group>" +
				// Specify the Medication ID.
				"<id>30cafccc-047d-4288-94ef-643571f7919d</id>" +
				// Specifies how to format the response.
				"<format>" +
					"<section>" +
						"core" +
					"</section>" +
					"<section>" +
						"audits" +
					"</section>" +
					"<section>" +
						"effectivepermissions" +
					"</section>" +
					"<section>" +
						"digitalsignatures" +
					"</section>" +
					"<section>" +
						"tags" +
					"</section>" +
					"<section>" +
						"blobpayload" +
					"</section>" +
				"</format>" +
			"</group>" +

accessor.send(request, connection);
Response response = accessor.getResponse();
int numRead;
byte[] chunk = new byte[4096];
InputStream inputStream = response.getInputStream();
while((numRead = != -1) {
	System.out.print(new String(chunk, 0, numRead));
Sep 20, 2012 at 7:31 PM
Edited Sep 20, 2012 at 7:32 PM


The field you are using for "id", is intended to uniquely indentify thing instances.  You want to use the field for thing-type id.


  <group max="30">

Are you able to use the jaxb library?  It can help you format the xml correctly. 


Sep 20, 2012 at 8:48 PM

I haven't yet looked into the jaxb library, simply because I want to get it working on my own. This is exactly what I was missing! Thank you very much!

Sep 20, 2012 at 9:07 PM

What I get back is the list of medications as "thing-id"s. Now, I need to figure out what to do with them to get the actual information about the medications, i.e. name, dose, doctor's name, etc.. I can figure this out on my own, I hope, but I thought I would mention it in case anyone has already been down this path and has a quick answer.

Thanks again!


Sep 20, 2012 at 11:34 PM

To answer my own question, I missed your "xml" tags within the "format" tag above. Seems a little odd that I need it, but, hey, I have the data now.



Sep 24, 2012 at 7:07 PM

I tried using it with JAXB and am having one major problem, which is more for HealthVault and not the API. I used JAXB to create Java classes representing the medication and used XPath to pull out the "medication" node. Then, I passed each of those "medication" nodes into JAXB's unmarshaller, but, because the "medication" tags aren't namespaced, JAXB doesn't like it. HealthVault did a great job of namespacing all of their XSD files, but I wish they would add namespace attributes to their returned data.



Sep 24, 2012 at 9:50 PM

Yes, I had to jump through some hoops to create the Jaxb classes.  Have you tried the jaxb classes in the sdk?  Medication should be there. 

Sep 25, 2012 at 8:24 PM

Interesting. I didn't see it before, so I grabbed the XSD files and compiled them myself. I will probably use the library instead. If you had a more programmatic solution for offline access than the one I proposed above, I would use that too. That might even exist, but there seems to be a lack of documentation (or, at the very least, a lack of pointers to documentation), which makes it difficult to understand which classes I should focus on to get started.

Our project will only be used in a small, controlled environment, so I don't need a completely robust solution. I will probably just stay with the code above with a few minor tweaks. That said, had there been some sort of "Quick Start for Dummies" page that explained how to set things up (it took me forever to realize you needed to put your "" and "keystore" files in the classpath and then it automagically works), two example authentication flows (one for online access and one for offline access), and one or two examples about how to pull something from HealthVault, it would have vastly reduced the time it would have taken my to get up to speed. From the perspective of someone who is new to HV and your library and wanted to dive right in, your library is exactly what I would want to use. It's just hard to figure out where to begin.

Thanks again for your help! :)


Sep 26, 2012 at 7:47 PM

I hear you with the documentation!  It's pretty darned thin.  Without it, I try to point folks at the sample apps and the unit tests.  It's something to work on for sure.  Thanks for persevering!