WPS icon indicating copy to clipboard operation
WPS copied to clipboard

Load service endpoints via Spring

Open nuest opened this issue 11 years ago • 5 comments

To allow other modules than 52n-wps-service to define web service endpoints (see #84 #76) we need a more flexible loading mechanism. Since the upcoming admin app uses Spring, this mechanism should also use Spring (and we throw away code from #84).

Steps:

  1. Configure existing web services via Spring
    • WebProcessingService
    • RetrieveResultServlet
  2. Create example endpoint (e.g. based on https://github.com/nuest/WPS/blob/bbae347370c32fb23e12cf50275d2048dbb42544/52n-wps-r/src/main/java/org/n52/wps/server/r/RResource.java)
    • The following endpoints could deliver dummy reponses
      • http://localhost:8080/wps/modules/r/sessionInfo
      • http://localhost:8080/wps/modules/r/resource
      • http://localhost:8080/wps/modules/r/script
    • Maybe we can still use Jersey annotations here?
      • http://stackoverflow.com/questions/14722029/how-to-configure-jersey-with-spring-using-only-annotations
      • https://jersey.java.net/documentation/latest/spring.html
      • Example looks straightforward: https://github.com/jersey/jersey/tree/2.11/examples/helloworld-spring-webapp
    • Should there be a hierarchy? Such as /wps/52n-wps-r/<here is where the modules can do what they want>, or can modules use any URL?
  3. Create documentation about creating new endpoints

@bpross-52n starts with these steps 1 and 2 (potentially consulted by @autermann) and @nuest takes over to actually implement the requirements for WPS4R

nuest avatar Jul 25 '14 10:07 nuest

I created a branch where I added an applicationContext file defining three beans for the wpsServlet, the retrieveResultServlet and and an example RResource class: https://github.com/bpross-52n/WPS/tree/use-spring-for-servlet-config. I am afraid, the resource class, i.e. the URLs don't seem to be available. I tried a few things but had no luck. @nuest Do you want to take another look? Maybe I missed something.

bpross-52n avatar Aug 04 '14 12:08 bpross-52n

I'll try my luck.

nuest avatar Aug 04 '14 13:08 nuest

@bpross-52n Do integration tests work for you?

nuest avatar Aug 05 '14 09:08 nuest

I made some progress, feedback and testing welcome: https://github.com/nuest/WPS/tree/feature/use-spring-for-servlet-config

Open tasks:

  • [x] fix webAdmin app - though I am not sure this is worth it
  • [x] run integration tests and fix them
  • [x] ~~remove security config from web.xml (afai understand this will soon be outdated anyway)~~ make it work
  • [x] ~~fix bug with writing of exception responses, e.g. calling http://localhost:8080/wps/WebProcessingService?Request=DescribeProcess&service=WPS&identifier=org.n52.wps.server.algorithm.test.EchoProcess > results in empty document on the client side~~ (cannot replicate that anymore)

nuest avatar Aug 07 '14 17:08 nuest

I also implemented a method to have an ITransactionalAlgorithmRepository managed by Spring, see https://github.com/nuest/WPS/tree/8869a4f3f93e04ed6a74ab0c5ac5d661e45dba3d/52n-wps-r/src/main/java/org/n52/wps/server/spring and example configuration:

<Repository name="RAlgorithmRepository" className="org.n52.wps.server.spring.SpringWrapperAlgorithmRepository" active="true">
      <Property active="true" name="wrappeeName">org.n52.wps.server.r.LocalRAlgorithmRepository</Property>
    </Repository>
    <Repository name="LocalRAlgorithmRepository" className="org.n52.wps.server.r.LocalRAlgorithmRepository" active="false">
[...]

Comments welcome!

nuest avatar Aug 13 '14 08:08 nuest