Calling GetThings webservice

Jul 6, 2010 at 10:22 AM

Hi,

I have downloaded java SDK code. and run sample weight application. It is working fine. I have run the weight application by logging in throgh

http://localhost:8080/jwildcat-1.4-ui/ this url with my HealthVault's Windows LIVE Id credentials.I have not created any certificate or key for this example. It is using default keys.

How can I use certificate or keys used in sample applications in this program?

Now I am using this sample program to call HealthVault webservice getThings

    StringBuilder requestXml = new StringBuilder();
        requestXml.append("<info><group>");
        requestXml.append("<filter><type-id>bd0403c5-4ae2-4b0e-a8db-1888678e4528</type-id></filter>");
        requestXml.append("<format><section>core</section><section>otherdata</section><xml/></format>");
        requestXml.append("</group></info>");
        Request request = new Request();
        request.setMethodName("GetThings");
        request.setOfflineUserId("e2f925e7-2748-4d88-bz48-32036dc10020");
        request.setRecordId("73ab2792-5481-43eb-837c-67d1e3337300");
        request.setInfo(requestXml.toString());
        Connection connection = ConnectionFactory.getConnection();
        HVAccessor accessor = new HVAccessor();
        accessor.send(request, connection);

 

When I am trying to run this program I am getting following Exception.

 Exception in thread "main" com.microsoft.hsg.HVException: com.microsoft.hsg.HVSystemException: Could not get private key information
    at com.microsoft.hsg.ConnectionFactory.getConnection(ConnectionFactory.java:68)
    at com.microsoft.hsg.ConnectionFactory.getConnection(ConnectionFactory.java:79)
    at com.microsoft.hsg.applications.TrialConnection1.main(TrialConnection1.java:36)
Caused by: com.microsoft.hsg.HVSystemException: Could not get private key information
    at com.microsoft.hsg.DefaultPrivateKeyStore.initData(DefaultPrivateKeyStore.java:160)
    at com.microsoft.hsg.DefaultPrivateKeyStore.getPrivateKey(DefaultPrivateKeyStore.java:112)
    at com.microsoft.hsg.ApplicationAuthenticator.ensurePrivateKey(ApplicationAuthenticator.java:225)
    at com.microsoft.hsg.ApplicationAuthenticator.authenticate(ApplicationAuthenticator.java:137)
    at com.microsoft.hsg.ApplicationAuthenticator.authenticate(ApplicationAuthenticator.java:130)
    at com.microsoft.hsg.Connection.authenticate(Connection.java:163)
    at com.microsoft.hsg.Connection.authenticate(Connection.java:172)
    at com.microsoft.hsg.ConnectionFactory.getConnection(ConnectionFactory.java:62)
    ... 2 more
Caused by: com.microsoft.hsg.HVException: Key not found
    at com.microsoft.hsg.DefaultPrivateKeyStore.initData(DefaultPrivateKeyStore.java:142)
    ... 9 more

 

I have run following 2 commands but It is giving same error

keytool -genkey -keyalg RSA -keysize 2048 -keystore keystore -alias java-wildcat -validity 9999

keytool -export -alias java-wildcat -keystore keystore > my-pub.cer

Is it required to send "my-pub.cer" created above to send to healthvault and get keys? or I can use the sample's keys only? 

I have also tried to run this command

keytool –keystore cacerts –exportcert –alias gtecybertrustglobalca > gte.crt

but keystore option is not there? Please let me know the steps to follow to get my above program to work.

Thanks..