错误 -(无详细信息)(进一步诊断:不支持为“Accept”标头提供的值。)

问题描述 投票:0回答:1

我有一个 Azure 函数,可以调用 FHIR 服务。代码如下。

var resultBundle = await fhirClient.OperationAsync(
    operation: new Uri($"{_config.GetValue<string>($"FhirServerUrl")}/Location/$getAllLocationsForFacility?coid={request.coid}&status=active"), 
    useGet: true) as Bundle;

执行此行时,我收到以下错误。

Executed 'Azure_Function_FunctionName' (Failed, Id=73423f7676-68d9-809d-s998-87867676969, Duration=21130ms)
[2024-02-26T07:10:35.843Z] System.Private.CoreLib: Exception while executing function: Azure_Function_FunctionName. Hl7.Fhir.DSTU2.Core: Operation was unsuccessful because of a client error (NotAcceptable). OperationOutcome: Overall result: FAILURE (1 errors and 0 warnings)
[2024-02-26T07:10:35.847Z]
[2024-02-26T07:10:35.848Z] [ERROR] (no details)(further diagnostics: Value supplied for the "Accept" header is not supported.).

我搜索了 dotnet 的 FHIR 文档。但我没有看到 fhirClient.OperationAsync() 方法的任何定义?对这个方法和错误消息有什么想法吗?

asp.net azure-functions hl7-fhir fhir-server-for-azure
1个回答
0
投票

FhirClient.OperationAsync 会向 FHIR 服务器发送 HTTP 请求,请求执行指定的操作(getAllLocationsForFacility)。 HTTP 调用的详细信息,例如响应接受的 Content-Type 和 mimetype 由 FhirClient 设置。

在您的情况下,响应表明服务器不支持请求的 Accept 标头中的 mime 类型值。这可能有几个原因。检查服务器可以响应的类型,并使用 FhirClient.PreferredFormat 设置相应地设置 Accept 标头。

请检查代码中是否使用了正确的 FHIR 版本,因为 Azure 服务显然使用 DSTU2 并且其 MIME 类型与目前使用最广泛的版本 FHIR R4 中的不同。

这里有一些关于 FhirClient 的文档:https://docs.fire.ly/projects/Firely-NET-SDK/en/latest/client.html,但没有关于操作调用的解释。您可以使用 VS 中的内联文档,或在 GitHub 上查找源代码:https://github.com/FirelyTeam/firely-net-sdk/

© www.soinside.com 2019 - 2024. All rights reserved.