Creating Java Spring MVC 3 based application with services,
I am new to Spring MVC3 framework in java but I am familiar with java coding.
I want to write two application using this framework.
- First application recieves requests through a SOAP web services and sends response in form of SOAP XML Object.
- Second application have a simple servlet to recieve request and send responces.
I have studied Java MVC3 framework. It requires view to be cal开发者_如何学JAVAled who are mapped against which controller will handles its request. But,
How I can do this using a webservice, so that when a specific method using SOAP services is called, I can forward that request to its relevant servlet and sends response back as a SOAP xml file.
How can I do this for my second application as well that recieves request through a servlet.
I hope all this make sense.
regards, Aqif
If you want to stick with Spring, you can use Spring Web Services for application 1. Application 2 would be a more traditonal Spring Web app (uses a servlet, but framework does not require you to work in the servlet...instead you will work in more fine grained components).
If you dont want to stick with Spring for the web services, you can always use something like Apache Axis
The usual structure is as follows:
- you have spring-mvc controllers to handle your browser requests
- you have other components that handle the SOAP requests
- both of the above invoke the same underlying services which serve them with the data that is to be sent to the user. The data is in java objects, which are later transformed to whatever is required
For the 2nd point you can pick some JAX-WS implementation, like CXF (it has nice spring support as well)
Spring Web Services specifically supports a Spring MVC-like model for responding to SOAP calls, as you describe.
the second one is Spring MVC directly. Heck, it sounds like - though I can't be sure without more information - that you're trying to build RESTful web services. There, too, Spring MVC is the right choice.
精彩评论