Issue with FHIR module in standalone OpenMRS 2.5: no resources found

I downloaded the OpenMRS Reference Application 2.5 Standalone edition. I started the application following the instructions. Everything seems to be working except for the FHIR module. It starts fine, but trying to call any of its services fails.

My environment: Windows 7 Java 1.8.0_111 OpenMRS Reference App 2.5; demo setup (with some patients) FHIR module 1.6 (the default one; I also tried the latest 1.7-SNAPSHOT from github, and a rolled-back version 1.4 - same results for all).

After deployment, I try to call http://localhost:8081/openmrs-standalone/ws/fhir/metadata http://localhost:8081/openmrs-standalone/ws/fhir/Patient/235c33ea-e728-461f-ab44-90b8b32cc91e

I get back a response with “Resource does not exist.”. Calls like that have the following error in the embedded tomcat log file: WARN - DispatcherServlet.noHandlerFound(1120) |2016-12-23 13:20:27,337| No mapping found for HTTP request with URI [/openmrs-standalone/ws/fhir/metadata] in DispatcherServlet with name ‘openmrs’

The similar call works just fine on the Demo server http://uat01.openmrs.org:8080/openmrs/ws/fhir/metadata (after logging in)

The swagger documentation link also doesn’t work on my local machine: http://localhost:8081/openmrs-standalone/module/fhir/apidocs.form Similar error in the tomcat log: WARN - DispatcherServlet.noHandlerFound(1120) |2016-12-23 13:44:21,697| No mapping found for HTTP request with URI [/openmrs-standalone/module/fhir/rest/swagger.json] in DispatcherServlet with name ‘openmrs’

The regular RESTful API works fine: http://localhost:8081/openmrs-standalone/ws/rest/v1/patient/235c33ea-e728-461f-ab44-90b8b32cc91e returns the patient information as expected.

Please let me know if I’m missing some configuration, or if it’s a bug in the code, and the FHIR module does not work for the standalone edition.

My current suspicion is that the FHIR module has the “openmrs” path hard-coded somewhere, and it doesn’t recognize “openmrs-standalone”… There are definitely bunch of places in the FHIR module with hardcoded “openmrs” path.

I have deployed the same FHIR omod with a openmrs-core in Vagrant - that returns the FHIR data as expected.

I have just made a commit to the module. Can you compile the latest snapshot version and test again?

That fixed the FHIR calls! I get back the results now. Thanks, Daniel.

The swagger links still don’t work - if I had to guess, it’s probably the hard-coded paths in SwaggerDocConstants.java and FHIROmodConstants.java.

Do the swagger links work for context paths that are “openmrs”?

Yes. For the FHIR module that I ran in vagrant with openmrs-core (so the path is http://192.168.33.10:8080/openmrs/module/fhir/apidocs.form), the swagger page loaded fine and displayed the expected endpoints.

For standalone the page just never loads and I see the following in tomcat logs:

WARN - DispatcherServlet.noHandlerFound(1120) |2017-01-04 10:10:58,269| No mapping found for HTTP request with URI [/openmrs-standalone/module/fhir/rest/swagger.json] in DispatcherServlet with name ‘openmrs’

I have just made another commit for the module. Can you try the latest snapshot version to see if it fixes the problem?

Works! Thank you.

So, the FHIR module, as released in Platform 2.0.* and in Refapp 2.5, does not work at all if you deploy the webapp as something other than /openmrs, right?

So, let’s get a new version of the FHIR module released, and make sure it’s in the next maintenance release of Platform 2.0.x.

(And Daniel, please create a ticket for the code you committed!)