问题
I want to write a hello world Spring MVC web service in Java. I'm really struggling to find a tutorial that goes to the basics to allow me to do this - ie. step by step for hello world.
Can anyone please help?
回答1:
Spring Web Services (Spring-WS
) is a product of the Spring community focused on creating document-driven
Web services. It aims to facilitate contract-first SOAP service development. Some of its key features are:
- Powerful mappings The incoming XML requests can be distributed to any
object
, depending onmessage payload
, SOAP Action header, or an XPath expression. - XML API support Incoming XML messages can be handled not only with standard
JAXP
APIs such asDOM
,SAX
, and StAX, but also JDOM, dom4j, XOM, or evenmarshalling
technologies. - Flexible XML Marshalling Spring Web Services builds on the
Object/XML Mapping module in the Spring Framework, which supports
JAXB 1
,JAXB 2
,Castor
,XMLBeans
,JiBX
, andXStream
. - Reuses your Spring expertise Spring-WS uses
Spring application contexts
for all configuration, which should help Spring developers get up-to-speed nice and quickly. Also, the architecture ofSpring-WS
resembles that ofSpring-MVC
. - Supports WS-Security WS-Security allows you to
sign
SOAP messages, encrypt and decrypt them, orauthenticate
against them. - Integrates with Spring Security The WS-Security implementation of Spring Web Services provides integration with
Spring Security
.
Here are the List of tutorials and documentations to help to get started with
Spring-ws
:
- Youtube - Spring-WS Tutorial
- Spring Web Services Tutorial
- Building a SOAP Webservices Proxy Module
- Official - Spring Web Services Reference Documentation
- Spring 4 + SOAP Web Service Producer and Consumer Example
SOAP is broad and complex topic, unlike REST API. You might want to get the concepts clear before starting with the implementation.
来源:https://stackoverflow.com/questions/33762027/hello-world-soap-web-service-using-spring-mvc