Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java中调用HealthVault GetThings方法_Java_Healthvault - Fatal编程技术网

在Java中调用HealthVault GetThings方法

在Java中调用HealthVault GetThings方法,java,healthvault,Java,Healthvault,我试图使用在“脱机”模式下调用GetThings方法(也就是说,用户不必登录)来检索所有“文件”类型的项目。据我所知,您只需发出脱机请求,即可获得用户帐户的Persion ID和Record ID。然而,即使我将这些添加到请求中,方法调用也不起作用。它在响应中返回错误代码“67”,根据API中的静态变量,它表示“无效的个人或组ID” 我仔细检查了人员ID和记录ID,它们确实是正确的。在“在线”模式下发出相同的请求(即,当包含用户身份验证令牌时)效果非常好。我的应用程序被配置为允许脱机访问所有“文

我试图使用在“脱机”模式下调用GetThings方法(也就是说,用户不必登录)来检索所有“文件”类型的项目。据我所知,您只需发出脱机请求,即可获得用户帐户的Persion ID和Record ID。然而,即使我将这些添加到请求中,方法调用也不起作用。它在响应中返回错误代码“67”,根据API中的静态变量,它表示“无效的个人或组ID”

我仔细检查了人员ID和记录ID,它们确实是正确的。在“在线”模式下发出相同的请求(即,当包含用户身份验证令牌时)效果非常好。我的应用程序被配置为允许脱机访问所有“文件”项类型,因此它不可能是访问问题

出于安全原因,我在下面的代码示例中将真人ID和记录ID替换为假ID:

以下是我的Java代码:

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);

非常感谢您的帮助。:)

另一个人通过这样做解决了这个错误。你已经试过了

I got the error cleared up. I re-imported the certificate (found in the cert
folder) through the Healthvault Application Manager, cleared up the offline.txt
file and re-ran the application.

原来问题是我的个人和记录ID实际上是不正确的。我使用的是连接到示例应用程序时得到的,而不是我自己的应用程序。我不知道它们在不同的应用程序中发生了变化。从我自己的应用程序中调用GetPersonInfo后,我能够获得正确的人员并记录ID。

感谢您的建议。听起来好像是他的证书问题。我试着重新创建我的密钥库(我在使用Java…他可能在使用.NET),但那没有帮助。我在“在线”模式下使用相同的密钥库,没有问题。
<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>
        <code>67</code>
        <error>
            <message>Exception of type
                'Microsoft.Health.Platform.WildcatStatusException' was thrown.</message>
        </error>
    </status>
</response>
I got the error cleared up. I re-imported the certificate (found in the cert
folder) through the Healthvault Application Manager, cleared up the offline.txt
file and re-ran the application.