sun-jaxws.xml - When is it needed and when not?

2019-03-08 19:54发布

问题:

I'm giving JAX-WS a high overview and noticed some references to sun-jaxws.xml (along with com.sun.xml.ws.transport.http.servlet.WSServletContextListener and com.sun.xml.ws.transport.http.servlet.WSServlet).

In what situations is this needed? (I think JSR 109 servers?!)

回答1:

sun-jaxws.xml is a proprietary deployment descriptor needed when web services are deployed as a standard WAR archive on a non-Java EE5 servlet container using the SUN's reference implementation.

Sun's RI uses WSServletContextListener as the listener for servlet context events and WSServlet as the dispatcher servlet; both of which have to be declared in web.xml. The sun-jaxws.xml file is then required to define web service end points for the WSServlet to let it know to which end point a service request must be dispatched.

In this way, web services can be run in any JAX-WS RI enabled servlet container, although they won't be portable.

Java EE 5+ compliant application servers such as Glassfish, the reference implementation, comply to JSR 109 (Web services 1.2/1.3) and JSR 224 (JAX-WS 2.0/2.1/2.2) and do not require non-standard sun-jaxws.xml deployment descriptors.

Please see here for more information:

http://jax-ws.java.net/nonav/2.2.1/docs/UsersGuide.html#1.0_Introduction

http://www.ibm.com/developerworks/java/library/j-jws9/index.html