Search code examples
javahl7-fhir

Resource contains external reference to URL xxx but this server is not configured to allow external references


Seeing such message in the logs:

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

As I understand it comes from line

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

I saw in the logs the PUT request is being made to http://fhir.openelis.org:8080/fhir/Task/001a3df6-98c6-4c41-9ead-1387f55e4ecb

but when I make this put request in postman, I get

{
"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>\n\t\t\t</tr>\n\t\t</table>\n\t</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"
    }
]
}

I see those logs have prefix HAPI and number. Where can I find the information about those errors meanings and how to solve them?

How to understand

"A FHIR Content-Type is required for "UPDATE" operation" ?

I have addded FHIR content type, why it still complains?

How to configure server to allow external references?


Solution

  • How my lead solved this: there is a service in docker-compose.yml fhir.someservice.org

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

    I removed other code from the service code but just left what he changed - changed image and added environment variable with this config. I do not know why this works but it works, maybe will be useful for someone.

    Also removed

    restart: always
    

    and volumes: and secrets:

    but those maybe are just a clean up and irrelevant.