Files
2014-07-02 17:50:55 +08:00
..
2014-07-02 17:50:55 +08:00
2014-07-02 17:50:55 +08:00
2014-07-02 17:50:55 +08:00

jaxws-with-spring

JAX-WS Spring Integration Example

mvn jetty:run

第一种方式

使用WSSpringServlet和ContextLoaderListener以及使用wss:binding配置

http://localhost:8080/hello

http://localhost:8080/hello?wsdl

http://localhost:8080/jaxws-spring

http://localhost:8080/jaxws-spring?wsdl

第二种方式

使用WSServletContextListener和sun-jaxws.xml方式

web.xml中添加内容

	<listener>
		<listener-class>
			com.sun.xml.ws.transport.http.servlet.WSServletContextListener
		</listener-class>
	</listener>
	<servlet>
		<servlet-name>sayhello</servlet-name>
		<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>sayhello</servlet-name>
		<url-pattern>/sayhello</url-pattern>
	</servlet-mapping>

sun-jaxws.xml中内容

<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
	<endpoint name="WebServiceImpl"
		      implementation="com.javacodegeeks.enterprise.ws.WebServiceImpl"
		      url-pattern="/sayhello" />
</endpoints>

该方式不需要在applicationContext.xml中配置任何内容

http://localhost:8080/sayhello

http://localhost:8080/sayhello?wsdl

参考链接

http://www.mkyong.com/webservices/jax-ws/jax-ws-spring-integration-example/

http://examples.javacodegeeks.com/enterprise-java/jws/jax-ws-spring-integration-example/

http://examples.javacodegeeks.com/enterprise-java/jws/jax-ws-web-services-on-tomcat/