after bashing my head against a brick wall on this one, i've finally got a simple example together of how to assemble a Spring Integration Web Service Inbound gateway which includes the following;
- simple POJO Service
- XSD of an object
- JAXB generated domain objects
- Spring-WS dynamic WSDL
- Spring Integration WS Endpoint and Test Client
Domain Object
let's start by putting together a domain object. This is a really simple domain object with a couple of simple components that built from an XSD
and here's a sample xml based on that schema
now we need to generate the Java objects from this. to do that, we can use Eclipses built-in JAXB Component "JAXB Classes from Schema"
Service
ok, so the idea is that we create a service to manage these objects. as with all Spring Integration projects, we should focus on a separation of concerns and should be able to use the service independently of Spring Integration.
and lets create a dead simple implementation of the service
Spring
now for the wiring...
for the sake of separation, we'll create 3 different spring files
- our Spring Integration configuration (what we'll do with a message)
- our XML Parser configuration (how we'll sort out the XML piece)
- our URI and WSDL configuration
here's the integration config
and here's the parser config
and finally, the Web Service config using a Dynamic WSDL generator
for the server part, we'll need to expose the relevant Spring Servlet via the web.xml...
and here's the parser config
and finally, the Web Service config using a Dynamic WSDL generator
Server Side
for the server part, we'll need to expose the relevant Spring Servlet via the web.xml...
Does it work?
here's the two urls you can try to verify that it works;
- open up a browser and point to http://[your server]/[your app]/issueService/
your response should be a 405 - that's ok!
- open up a browser and point to http://[your server]/[your app]/issueService/issueService.wsdl
your response should be the WSDL file to use