I found its very difficult and redundant to wirte XML configuration to define spring webservice.
Example: To Expose WSDL<bean id="addService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" p:portTypeName="add" p:locationUri="http://localhost:9080/WebServiceExample/" p:requestSuffix="-request" p:responseSuffix="-response"> <property name="schema"> <bean class="org.springframework.xml.xsd.SimpleXsdSchema" p:xsd="classpath:/WEB-INF/Addition.xsd" /> </property> <property name="targetNamespace" value="addition.apps" />
and for JAXB context (defining marshaller and unmarshallers)
<bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter"> <property name="marshaller" ref="marshaller" /> <property name="unmarshaller" ref="marshaller" /> </bean> <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="apps.addition"></property> </bean> <bean id="wsTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> <property name="marshaller" ref="marshaller" /> <property name="unmarshaller" ref="marshaller" /> </bean>
Let say, I need to implement 100 webservices in an application then what is the complexity involved.
Can yo开发者_C百科u please suggest me the proper approach to reduce configuration for this.Any annotation driven approach? Thanks in AdvanceJAX-WS and JAXB both support annotations, and are supported by Spring Framework
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html
JAX-WS has (long ago) a reference Implementation using Spring configuration
http://www.springsource.org/node/396
More on JAX-WS http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
Spring WS has it's own annotation support as well
http://static.springsource.org/spring-ws/site/reference/html/server.html
More about the difference between Spring WS and JAX-WS
http://forum.springsource.org/showthread.php?77968-Spring-WS-vs-JAX-WS
if you like Spring WS because of the "contract first" approach, look at this one
http://rphgoossens.wordpress.com/2011/02/20/developing-a-contract-first-jax-ws-webservice/
Springboot provide support for creating webservice easy way. It reduce the configuration part like spring mvc(xml configuration).
https://spring.io/projects/spring-boot
https://spring.io/guides/gs/spring-boot/
精彩评论