Stream: implementers
Topic: FHIR Java Client
edward smith (Sep 25 2018 at 18:03):
how do i setup fhir java client on windows 10 pro
Lloyd McKenzie (Sep 25 2018 at 19:05):
What do you mean by "FHIR Java Client"?
Jan Høydahl (Nov 13 2019 at 09:34):
Using Java client to talk to a C# implementation of Audit Server. But it exposes the AuditEvent endpoint on '<base-path>/FHIRAuditEvent/' and I cannot find out how to configure the java client to use a custom endpoint. The urlPath seems to be parsed from the type annotation...
Jan Høydahl (Nov 13 2019 at 09:40):
I first tried to subclass AuditEvent
and change the annotation 'name'. Then the client would generate the correct URL path but the server got confused because it tried to parse into FHIRAuditEvent
which of course is unknown to the server. I want to post a plain AuditEvent JSON but to a different endpoint URL.
Jan Høydahl (Nov 13 2019 at 09:42):
The client I'm using is HAPI FHIR 3.7.0, DSTU2 v1.0.2
Kevin Mayfield (Nov 13 2019 at 09:44):
You might be able to treat is as an operation.
Bundle result = client.operation().onServer()
.named("FHIRAuditEvent")
.withParameters(parameters)
.returnResourceType(Bundle.class)
.execute();
Jan Høydahl (Nov 13 2019 at 10:16):
Ok, I can try that next time. Will have to rewrite my simple client adapter class, but hopefully it is easy.
Question: Does the FHIR spec say somewhere that the resource should be served on the /AuditEvent endpoint?
Looks like you use Content-Type HTTP header to distinguish between various types such as application/json+fhir
while my client uses a new endpoint instead to do the same (I think)
Grahame Grieve (Nov 13 2019 at 10:20):
the server is not conformant, so it's not surprising that you can't make it work easily
Kevin Mayfield (Nov 13 2019 at 10:20):
Probably via the conformanceStatement. Is the FHIRAuditEvent listed in the servers <base-path>/metadata
Jan Høydahl (Nov 13 2019 at 17:36):
This is a minimal server implemented by a client of mine. They have not even implemented any conformanceStatement :) so I had to disable that in the client.
I'm green to FHIR, just wrote an app that needs to log to that server. And I don't have the history for why they have two different endpoints, one called /AuditEvent and another /FHIRAuditEvent. I'm just guessing when I say that the json+fhir content-type could/should be used to select parser rather than a different endpoint name. I'll try your workaround Kevin.
Jan Høydahl (Nov 15 2019 at 09:07):
@Kevin Mayfield So I tried your code client.operation().onServer, and it almost succeeded, except it tried to hit <base-path>/$FHIRAuditEvent which gives 404 since there is no '$' in the path on the server. Also I don't get how to go from Bundle to MethodOutcome that I used to have with my current client.
Jan Høydahl (Nov 15 2019 at 09:42):
Ok, I worked around it by search/replace of URI in my interceptRequest()
hook. Dirty since I had to cast IHttpRequest to ApacheHttpRequest and then pull out the inner HttpRequestBase from there, convert the getURI() to string, replace the path, wrap it in a URI again and modify the request. Wish there was a simple way on the client to provide a custom path for any event that you wish to post to server..
Patrick Werner (Nov 15 2019 at 09:56):
Wish there was a simple way on the client to provide a custom path for any event that you wish to post to server..
There is no way to alter the resource path as these paths are defined as part of the FHIR spec: https://www.hl7.org/fhir/http.html#styleguide
The easiest would be to get your server FHIR compliant.
Jan Høydahl (Nov 15 2019 at 13:46):
Thanks for your help on this. I now have a workaround until the server gets more compliant.
Last updated: Apr 12 2022 at 19:14 UTC