资源包含对URL xxx的外部引用,但此服务器未配置为允许外部引用



在日志中看到这样的消息:

11 Apr 2022 12:40:25 -- ERROR -- Class: jdk.internal.reflect.GeneratedConstructorAccessor245, Method: newInstance, Error: HTTP 400 : HAPI-0507: Resource contains external reference to URL "http://web-fhir/fhir/Task/9589a07d-6022-4b57-afeb-c9149679eedc" but this server is not configured to allow external references

据我所知,它来自

MethodOutcome outcome = fhirUtil.getFhirClient(localFhirStorePath).update().resource(taskBasedOnRemoteTask)
.execute();

我在日志中看到PUT请求被发送到http://fhir.openelis.org:8080/fhir/Task/001a3df6-98c6-4c41-9头-1387f55e4ecb

但当我在邮递员那里提出这个请求时,我得到了

{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns="http://www.w3.org/1999/xhtml"><h1>Operation Outcome</h1><table border="0"><tr><td style="font-weight: bold;">ERROR</td><td>[]</td><td><pre>HAPI-0449: Incorrect Content-Type header value of &quot;FHIR&quot; was provided in the request. A FHIR Content-Type is required for &quot;UPDATE&quot; operation</pre></td>nttt</tr>ntt</table>nt</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-0449: Incorrect Content-Type header value of "FHIR" was provided in the request. A FHIR Content-Type is required for "UPDATE" operation"
}
]
}

我看到那些日志的前缀是HAPI和数字。我在哪里可以找到关于这些错误含义的信息以及如何解决它们?

如何理解

"FHIR内容类型是";"更新";操作"?

我添加了FHIR内容类型,为什么它还抱怨?

如何配置服务器以允许外部引用?

"FHIR";不是有效的内容类型。允许的内容类型如下:http://build.fhir.org/http.html#mime-型

对你来说,你需要使用application/fhir+json

假设您使用的是hapi-jpastarter项目。要允许外部资源,您必须更改此行

我的潜在客户是如何解决这个问题的:docker-compose.yml fhir.someservice.org 中有一项服务

fhir.someservice.org:
image: "hapiproject/hapi:v5.6.0"
environment:
hapi.fhir.allow_external_references: "true"

我从服务代码中删除了其他代码,但只留下了他更改的内容——用这个配置更改了映像并添加了环境变量。我不知道为什么这有效,但它有效,也许对某人有用。

还删除了

restart: always

和数量:和秘密:

但这些可能只是一次清理,无关紧要。

最新更新