locked
Java: getPersonInfo shows Name record but not Weight record RRS feed

  • Question

  • Hello All

    I am using the java API to access health vault. Here is my code:

                                                    

     @Test

        public void GetPersonInfo() throws Exception
        {
    SimpleRequestTemplate requestTemplate = new SimpleRequestTemplate(
    ConnectionFactory.getConnection());
    requestTemplate.setUserAuthToken("AiAAAIJ6CQQjQxBJqJnCtlCbWzRR/D2EmY+WiQQZ1JqNe2zGohkLbu02APSf6HvRlzY+7oAAAADrrLs/Mh+KlLz2eU8cbRaEDPTLTD098q0HUAK0WCuL80yH+WcMhvI8AgEwO1FTlzqWyuce+B1aCTvLcTEldmpNGq3lcOwtUCe2pr3FB9kytLXctjhoh6sNIw81BoHd9GYznXyeok5TxuuBhvXeyxxkjlmDeuiu3dBk0XOFZBUx8iAAAADBMRC5YnXg2GHpQiUtKDNOf81INE9/a4rw8JpOmBAAZiAAAADBMRC5YnXg2GHpQiUtKDNOf81INE9/a4rw8JpOmBAAZg==");

    GetPersonInfoResponse response = 
    (GetPersonInfoResponse)requestTemplate.makeRequest(new GetPersonInfoRequest());
    System.out.println(response.getPersonInfo().getName());
    List<Record> recordList=response.getPersonInfo().getRecord();
    for(Record r : recordList) {
    System.out.println(r.getDisplayName() + " = " + r.getValue());
    }
    System.out.println(response.getPersonInfo().getGroups());

    Assert.assertNotNull(response);
        }

    I see the following response:

    DEBUG - Connection                 - <wc-request:request xmlns:wc-request="urn:com.microsoft.wc.request"><header><method>CreateAuthenticatedSessionToken</method><method-version>1</method-version><app-id>3318b9ae-31bb-4eb7-a721-daeac240c742</app-id><language>en</language><country>US</country><msg-time>2015-08-28T23:11:58</msg-time><msg-ttl>180000</msg-ttl><version>Java/1.3.0 JDK-1.5+</version></header><info><auth-info><app-id>3318b9ae-31bb-4eb7-a721-daeac240c742</app-id><credential><appserver><sig digestMethod="SHA1" sigMethod="RSA-SHA1" thumbprint="ad5b9aae608a793a623b55adbe6a8a7385f739b0">Nh8rYuyw8GQim8FxGEh48i1XQ7e8U/2WBMHq1HxMXJdZzVQnJxhSXIMrDfLOp5jHIERpXB6atl9qQm2cNWQ76Q+8MapTkVqAE9ytvZG9yTH4iKtPb8ACyQ44YbfSpd0kShToDwVxskYaKFg8qnEW6AMEkrJn12RfAmAPUn7Io1KpvLNQnockkwcXAevM8WoqzcNP8NL2YgjaiSfNSU15XZ2C6KWykRP4fISBMF6GcoqdC62LVxy/uPbdNo5d4odc0k9WDoErozKRTEJjG80WDFZhdDORWKWCm8e62L0VPo7LlFYhBE7iOu+x+i6W/j6NaAujzJ0S1K1NmmC0auwFSw==</sig><content><app-id>3318b9ae-31bb-4eb7-a721-daeac240c742</app-id><shared-secret><hmac-alg algName="HMACSHA256">kx4A63rtlBiiCAOA2pn1ey5+Tdg=</hmac-alg></shared-secret></content></appserver></credential></auth-info></info></wc-request:request>
    DEBUG - ResponseStrategy           - <response><status><code>0</code></status><wc:info xmlns:wc="urn:com.microsoft.wc.methods.response.CreateAuthenticatedSessionToken"><token app-id="3318b9ae-31bb-4eb7-a721-daeac240c742" app-record-auth-action="NoActionRequired">AiAAABtIj1/cF7hCo8SfMdERwdiifYZoBNeTJHgXFdZM74cwz6+hfQJ1qsq3zVb5tHM0h6AAAADwyLC31avFWJvn4JCy9o/woNXGi5DjvUiClOAjfZx9IW9acPQ7P3VgQt24xOsqaLVBhTFrRzbWzgIB3emCL0EBxUVdMZTpIGyujnhYp+WVYkTcLE+afXtke+eqcok75Ie+9xhRHnbTfdZGIdIMxOU1oAvam5yT7NB2Y2jqLfFsvTQnMa7EaRH3wOQizGcp8Je/9FgEj8vpzKXJaE19maIwIAAAACGRjxKEdBGhzZF4fP0W/dKqFIRWAi1c8yo3JWLMpobkIAAAACGRjxKEdBGhzZF4fP0W/dKqFIRWAi1c8yo3JWLMpobk</token></wc:info></response>
    DEBUG - Connection                 - <wc-request:request xmlns:wc-request="urn:com.microsoft.wc.request"><auth><hmac-data algName="HMACSHA256">EoT3uICNUFVnXTtTI7P/9d87C8cXMKZgp/fmWBBejO0=</hmac-data></auth><header><method>GetPersonInfo</method><method-version>1</method-version><auth-session><auth-token>AiAAABtIj1/cF7hCo8SfMdERwdiifYZoBNeTJHgXFdZM74cwz6+hfQJ1qsq3zVb5tHM0h6AAAADwyLC31avFWJvn4JCy9o/woNXGi5DjvUiClOAjfZx9IW9acPQ7P3VgQt24xOsqaLVBhTFrRzbWzgIB3emCL0EBxUVdMZTpIGyujnhYp+WVYkTcLE+afXtke+eqcok75Ie+9xhRHnbTfdZGIdIMxOU1oAvam5yT7NB2Y2jqLfFsvTQnMa7EaRH3wOQizGcp8Je/9FgEj8vpzKXJaE19maIwIAAAACGRjxKEdBGhzZF4fP0W/dKqFIRWAi1c8yo3JWLMpobkIAAAACGRjxKEdBGhzZF4fP0W/dKqFIRWAi1c8yo3JWLMpobk</auth-token><user-auth-token>AiAAAIJ6CQQjQxBJqJnCtlCbWzRR/D2EmY+WiQQZ1JqNe2zGohkLbu02APSf6HvRlzY+7oAAAADrrLs/Mh+KlLz2eU8cbRaEDPTLTD098q0HUAK0WCuL80yH+WcMhvI8AgEwO1FTlzqWyuce+B1aCTvLcTEldmpNGq3lcOwtUCe2pr3FB9kytLXctjhoh6sNIw81BoHd9GYznXyeok5TxuuBhvXeyxxkjlmDeuiu3dBk0XOFZBUx8iAAAADBMRC5YnXg2GHpQiUtKDNOf81INE9/a4rw8JpOmBAAZiAAAADBMRC5YnXg2GHpQiUtKDNOf81INE9/a4rw8JpOmBAAZg==</user-auth-token></auth-session><language>en</language><country>US</country><msg-time>2015-08-28T23:11:59</msg-time><msg-ttl>29100</msg-ttl><version>Java/1.3.0 JDK-1.5+</version><info-hash><hash-data algName="SHA256">bxTJ7U8Y5SeCj1ySpV5tp/tVnsou4JhSTelplyDKahM=</hash-data></info-hash></header><info/></wc-request:request>
    DEBUG - ResponseStrategy           - <response><status><code>0</code></status><wc:info xmlns:wc="urn:com.microsoft.wc.methods.response.GetPersonInfo"><person-info><person-id>3c3efc72-9192-4e9f-91bb-cfa97ff4bef2</person-id><name>Murthy Gandikota</name><selected-record-id>61d3cc18-a2ae-4edc-b4eb-2b59ea79b644</selected-record-id><record id="61d3cc18-a2ae-4edc-b4eb-2b59ea79b644" record-custodian="true" rel-type="1" rel-name="Self" auth-expires="9999-12-31T23:59:59.999Z" display-name="Murthy" state="Active" date-created="2015-08-27T21:25:29.777Z" max-size-bytes="4294967296" size-bytes="3131" app-record-auth-action="ReauthorizationRequired" app-specific-record-id="320339" location-country="US" date-updated="2015-08-28T22:12:51.037Z" latest-operation-sequence-number="9" record-app-auth-created-date="2015-08-28T20:18:17.99Z">Murthy Gandikota</record><preferred-culture><language>en-US</language></preferred-culture><preferred-uiculture><language>en-US</language></preferred-uiculture><location><country>US</country></location></person-info></wc:info></response>
    Murthy Gandikota
    Murthy = Murthy Gandikota
    null

    I am pretty sure that Weight was allowed all access to my app. But it is not coming up in the personInfo. By the way, I am using the PPE shell. 

    Any help is appreciated.

    Thanking you

    murthy

    Friday, August 28, 2015 11:28 PM

All replies

  • I am able to get weight  by  using selected-record-id from PersonInfo.  However, not getting Blood Pressure and Blood Glucose readings.  Here is my code.

                                                                                                                                

    public void GetThing() throws Exception
        {
    SimpleRequestTemplate requestTemplate = new SimpleRequestTemplate(
    ConnectionFactory.getConnection());
    requestTemplate.setUserAuthToken("AiAAAELaZ2IBce1HucCx1y2QQQS2xH02Z6qiJfcw4zHNaOvTBxyuyDZkRc9+z1k+MvHvR4AAAABXzH8IpFswuBS013IZtQTySiL70hhykoBmSe7LYcdLaW5U5y1MbqdMHe2R4TDTr2j2TNtqtYd5IqNpHW+rVJsVUwArS/jwBYcEJCiQwa2PsRfbFpEfk7LR82WaPgkdmuLV92dR0JiJjCo9AhkhhRSwJM4nVchTh+qBtC58TeZTsCAAAADO8C6xCnRqpNzXjYdYCn6fPlC7XgjrKdTLl3A+bOeh2CAAAADO8C6xCnRqpNzXjYdYCn6fPlC7XgjrKdTLl3A+bOeh2A==");
    //     requestTemplate.setPersonId("75ac2c6c-c90e-4f7e-b74d-bb7e81787beb");
    //     requestTemplate.setRecordId("8c390004-3d41-4f5c-8f24-4841651579d6");

    requestTemplate.setRecordId("61d3cc18-a2ae-4edc-b4eb-2b59ea79b644");

    ThingRequestGroup group = new ThingRequestGroup();

    ThingFilterSpec filter = new ThingFilterSpec();
    filter.getTypeId().add("ca3c57f4-f4c1-4e15-be67-0a3caf5414ed");//bp
    //     filter.getTypeId().add("3d34d87e-7fc1-4153-800f-f56592cb0d17");//weight
    //     filter.getTypeId().add("879e7c04-4e8a-4707-9ad3-b054df467ce4"); //glucose
    group.getFilter().add(filter);
    group.setMax(BigInteger.valueOf(30));

    ThingFormatSpec format = new ThingFormatSpec();
    format.getSection().add(ThingSectionSpec.CORE);
    format.getXml().add("");
    group.setFormat(format);    

    GetThingsRequest info = new GetThingsRequest();
    info.getGroup().add(group);

    GetThingsResponse response = 
    (GetThingsResponse)requestTemplate.makeRequest(info);
    List<ThingResponseGroup> thingGroupList = response.getGroup();
    for(ThingResponseGroup grp : thingGroupList) {
    List<Thing> thingList = grp.getThing();
    for(Thing thing : thingList) {
    System.out.println(thing.getData());
    }
    }
    //     BloodPressure bp = (BloodPressure)response.getGroup().get(0).getThing().get(0).getData();
    //     Weight weight = (Weight)response.getGroup().get(0).getThing().get(0).getData();
        }

    Thanks for your help 

    Saturday, August 29, 2015 5:48 PM