Hosting a new Web Services EP in OpenMRS

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)

  2. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)

  3. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

Hi Justin,

I’m afraid that i’ve been avoiding your email because I haven’t really focussed on SOAPish stuff before :slight_smile:

One thing you could do is join us on IRC (#openmrs) and maybe talk to Darius Jazayeri or Daniel Kayiwa directly ? I feel that a direct conversation might help you decide :slight_smile:

Best regards,

Suranga

···

On Mon, Jul 28, 2014 at 9:58 AM, justin.fyfe@ecgroupinc.com wrote:

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)
  1. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)
  1. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi Suranga,

I have found a potential solution however have been hitting a roadblock. I’m using the Spring-WS MessageDispatcherServlet and I thought it was all going well, however the dispatcher is thrown an NPE. The problem appears to be this line where OpenMRS provides the initial parameter list to the HttpServletBeanm this code is in the ModuleServlet.SimpleServletConfig class:

                            // not implemented in a module's config.xml yet

                            @SuppressWarnings("unchecked")

                            public Enumeration getInitParameterNames() {

                                            return null;

                            }

The code the HttpServletBean calls is this:

           Enumeration en = config.getInitParameterNames();

           while (en.hasMoreElements()) {

                   String property = (String) en.nextElement();

Which makes me think I won’t be able to do this Spring-WS’ built in dispatchers. The other route I can think of (for now) is to write a custom HttpServlet implementing doPost() to pass the SOAP body to Spring-WS’ soap processor manually. I can then suck out the body (and WS-A headers) and perform an appropriate call to the QED query service. Either that or I can perhaps write a servlet that extends MessageDispatcherServlet and provides static configuration values.

Either way is a hack, but I’m really stuck with this :S…

Cheers

-Justin

···

Hi Justin,

I’m afraid that i’ve been avoiding your email because I haven’t really focussed on SOAPish stuff before :slight_smile:

One thing you could do is join us on IRC (#openmrs) and maybe talk to Darius Jazayeri or Daniel Kayiwa directly ? I feel that a direct conversation might help you decide :slight_smile:

Best regards,

Suranga

On Mon, Jul 28, 2014 at 9:58 AM, justin.fyfe@ecgroupinc.com wrote:

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)
  1. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)
  1. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi Justin,

I did a little digging and I managed to find this: https://github.com/openmrs/openmrs-module-example-webservicepatientstub/blob/master/web/src/org/openmrs/module/webserviceexamplepatientstub/web/PatientWebService.java

It seems JAX-WS has been used in the past for doing SOAP binding in OpenMRS. The link is just a proof of concept but maybe something we can build on.

I am also looking to implement some SOAP web services in OpenMRS to implement the XDS.b repository transactions, so we should work together to try find a good uniform way to do this.

let me know if this helps or if you have already tried something similar.

Cheers,

Ryan

···

On Mon, Jul 28, 2014 at 10:25 PM, Justin Fyfe justin.fyfe@ecgroupinc.com wrote:

Hi Suranga,

I have found a potential solution however have been hitting a roadblock. I’m using the Spring-WS MessageDispatcherServlet and I thought it was all going well, however the dispatcher is thrown an NPE. The problem appears to be this line where OpenMRS provides the initial parameter list to the HttpServletBeanm this code is in the ModuleServlet.SimpleServletConfig class:

                            // not implemented in a module's config.xml yet
                            @SuppressWarnings("unchecked")
                            public Enumeration getInitParameterNames() {
                                            return null;
                            }

The code the HttpServletBean calls is this:

           Enumeration en = config.getInitParameterNames();
           while (en.hasMoreElements()) {
                   String property = (String) en.nextElement();

Which makes me think I won’t be able to do this Spring-WS’ built in dispatchers. The other route I can think of (for now) is to write a custom HttpServlet implementing doPost() to pass the SOAP body to Spring-WS’ soap processor manually. I can then suck out the body (and WS-A headers) and perform an appropriate call to the QED query service. Either that or I can perhaps write a servlet that extends MessageDispatcherServlet and provides static configuration values.

Either way is a hack, but I’m really stuck with this :S…

Cheers

-Justin

From: Suranga Kasthurirathne [mailto:surangak@openmrs.org]
Sent: Monday, July 28, 2014 4:02 PM
To: Justin Fyfe
Cc: openhie-shr@googlegroups.com
Subject: Re: Hosting a new Web Services EP in OpenMRS

Hi Justin,

I’m afraid that i’ve been avoiding your email because I haven’t really focussed on SOAPish stuff before :slight_smile:

One thing you could do is join us on IRC (#openmrs) and maybe talk to Darius Jazayeri or Daniel Kayiwa directly ? I feel that a direct conversation might help you decide :slight_smile:

Best regards,

Suranga

On Mon, Jul 28, 2014 at 9:58 AM, justin.fyfe@ecgroupinc.com wrote:

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)
  1. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)
  1. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.

To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


Ryan Crichton

Lead Developer, Jembi Health Systems | SOUTH AFRICA

Mobile: +27845829934 | Skype: ryan.graham.crichton
E-mail: ryan@jembi.org

Hi Ryan,

I was trying to stick to Spring-WS because it is a little easier to work with than JAX-WS, and you can write marshaller/unmarshallers for it to parse SOAP contents into something more friendly than XSD classes. I was able to get the MessageDispatcherServlet working to a point where it would complain about missing a servlet context file in /WEB-INF/v3-servlet.xml however I got stuck at that point and just wrote a shim in for now.

Spring-WS works when you override the servlet and pass it a configuration where getInitParamNames is this implementation:

/**

  • Return an empty enumeration

  • @see org.openmrs.module.web.ModuleServlet.SimpleServletConfig#getInitParameterNames()

*/

@Override

public Enumeration getInitParameterNames() {

   **return** **new** Enumeration<Object>() {



          @Override

    **public** **boolean** hasMoreElements() {

        // **TODO** Auto-generated method stub

        **return** **false**;

    }



          @Override

    **public** Object nextElement() {

        // **TODO** Auto-generated method stub

        **return** **null**;

    }

         

         

   };

}

Basically returning an empty enumeration instead of a null enumeration. I’d be happy to submit this as a change proposal to OpenMRS (or file as a bug with a solution of this). Then all we’d need to do is figure out how to get /WEB-INF in the module :wink:

Cheers

-Justin

···

Hi Justin,

I did a little digging and I managed to find this: https://github.com/openmrs/openmrs-module-example-webservicepatientstub/blob/master/web/src/org/openmrs/module/webserviceexamplepatientstub/web/PatientWebService.java

It seems JAX-WS has been used in the past for doing SOAP binding in OpenMRS. The link is just a proof of concept but maybe something we can build on.

I am also looking to implement some SOAP web services in OpenMRS to implement the XDS.b repository transactions, so we should work together to try find a good uniform way to do this.

let me know if this helps or if you have already tried something similar.

Cheers,

Ryan

On Mon, Jul 28, 2014 at 10:25 PM, Justin Fyfe justin.fyfe@ecgroupinc.com wrote:

Hi Suranga,

I have found a potential solution however have been hitting a roadblock. I’m using the Spring-WS MessageDispatcherServlet and I thought it was all going well, however the dispatcher is thrown an NPE. The problem appears to be this line where OpenMRS provides the initial parameter list to the HttpServletBeanm this code is in the ModuleServlet.SimpleServletConfig class:

                            // not implemented in a module's config.xml yet
                            @SuppressWarnings("unchecked")
                            public Enumeration getInitParameterNames() {
                                            return null;
                            }

The code the HttpServletBean calls is this:

           Enumeration en = config.getInitParameterNames();
           while (en.hasMoreElements()) {
                   String property = (String) en.nextElement();

Which makes me think I won’t be able to do this Spring-WS’ built in dispatchers. The other route I can think of (for now) is to write a custom HttpServlet implementing doPost() to pass the SOAP body to Spring-WS’ soap processor manually. I can then suck out the body (and WS-A headers) and perform an appropriate call to the QED query service. Either that or I can perhaps write a servlet that extends MessageDispatcherServlet and provides static configuration values.

Either way is a hack, but I’m really stuck with this :S…

Cheers

-Justin

From: Suranga Kasthurirathne [mailto:surangak@openmrs.org]
Sent: Monday, July 28, 2014 4:02 PM
To: Justin Fyfe
Cc: openhie-shr@googlegroups.com
Subject: Re: Hosting a new Web Services EP in OpenMRS

Hi Justin,

I’m afraid that i’ve been avoiding your email because I haven’t really focussed on SOAPish stuff before :slight_smile:

One thing you could do is join us on IRC (#openmrs) and maybe talk to Darius Jazayeri or Daniel Kayiwa directly ? I feel that a direct conversation might help you decide :slight_smile:

Best regards,

Suranga

On Mon, Jul 28, 2014 at 9:58 AM, justin.fyfe@ecgroupinc.com wrote:

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)
  1. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)
  1. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Crichton

Lead Developer, Jembi Health Systems | SOUTH AFRICA

Mobile: +27845829934 | Skype: ryan.graham.crichton
E-mail: ryan@jembi.org

By the way, this was inspired by this module: https://github.com/openmrs/openmrs-module-example-webservice

Which uses Spring-WS to wrap Jax-WS…

···

Hi Justin,

I did a little digging and I managed to find this: https://github.com/openmrs/openmrs-module-example-webservicepatientstub/blob/master/web/src/org/openmrs/module/webserviceexamplepatientstub/web/PatientWebService.java

It seems JAX-WS has been used in the past for doing SOAP binding in OpenMRS. The link is just a proof of concept but maybe something we can build on.

I am also looking to implement some SOAP web services in OpenMRS to implement the XDS.b repository transactions, so we should work together to try find a good uniform way to do this.

let me know if this helps or if you have already tried something similar.

Cheers,

Ryan

On Mon, Jul 28, 2014 at 10:25 PM, Justin Fyfe justin.fyfe@ecgroupinc.com wrote:

Hi Suranga,

I have found a potential solution however have been hitting a roadblock. I’m using the Spring-WS MessageDispatcherServlet and I thought it was all going well, however the dispatcher is thrown an NPE. The problem appears to be this line where OpenMRS provides the initial parameter list to the HttpServletBeanm this code is in the ModuleServlet.SimpleServletConfig class:

                            // not implemented in a module's config.xml yet
                            @SuppressWarnings("unchecked")
                            public Enumeration getInitParameterNames() {
                                            return null;
                            }

The code the HttpServletBean calls is this:

           Enumeration en = config.getInitParameterNames();
           while (en.hasMoreElements()) {
                   String property = (String) en.nextElement();

Which makes me think I won’t be able to do this Spring-WS’ built in dispatchers. The other route I can think of (for now) is to write a custom HttpServlet implementing doPost() to pass the SOAP body to Spring-WS’ soap processor manually. I can then suck out the body (and WS-A headers) and perform an appropriate call to the QED query service. Either that or I can perhaps write a servlet that extends MessageDispatcherServlet and provides static configuration values.

Either way is a hack, but I’m really stuck with this :S…

Cheers

-Justin

From: Suranga Kasthurirathne [mailto:surangak@openmrs.org]
Sent: Monday, July 28, 2014 4:02 PM
To: Justin Fyfe
Cc: openhie-shr@googlegroups.com
Subject: Re: Hosting a new Web Services EP in OpenMRS

Hi Justin,

I’m afraid that i’ve been avoiding your email because I haven’t really focussed on SOAPish stuff before :slight_smile:

One thing you could do is join us on IRC (#openmrs) and maybe talk to Darius Jazayeri or Daniel Kayiwa directly ? I feel that a direct conversation might help you decide :slight_smile:

Best regards,

Suranga

On Mon, Jul 28, 2014 at 9:58 AM, justin.fyfe@ecgroupinc.com wrote:

Hello All,

I’ve posted an issue like this in the oMRS dev group however haven’t gotten a reply back so I thought I’d try here. (Original link https://groups.google.com/a/openmrs.org/forum/#!topic/dev/Le6S1wnyZJA)

I have some basic HL7v3 message processing working (mostly just the request and query parameters) in a module which I’m testing via Junit for the time being. The issue I’m having now is how do I expose this functionality via a SOAP endpoint from the OpenMRS module, or if this is even possible? So far I see three ways of doing this:

  1. I can create a new web app that hosts the HL7v3 service and invokes the OpenMRS API (not ideal)
  1. The module creates a new SOAP endpoint (something like /v3/QUPC_AR004030UV) leveraging some existing Spring web-services module (which I can’t find any documentation on)
  1. The module just has a controller page that accepts a POST and I manually use Spring to parse the SOAP bits (this is a total hack)

Is there another way of doing this, and/or is there some other example module that I could pull down the source code for to see an example of how another module did this? Like I said in the original post, most of the existing WS stuff points to the SVN which appears to be gone.

Cheers

-Justin

You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups “Shared Health Record (OpenHIE)” group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhie-shr+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Crichton

Lead Developer, Jembi Health Systems | SOUTH AFRICA

Mobile: +27845829934 | Skype: ryan.graham.crichton
E-mail: ryan@jembi.org