29

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?!)

JohnDoDo
  • 4,720
  • 8
  • 31
  • 47

1 Answers1

41

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

RGO
  • 4,586
  • 3
  • 26
  • 40
  • 1
    Thanks for the answer. One question though, what does "non-Java EE5 servlet container" mean? A certain version of the servlet api or what? – JohnDoDo Sep 26 '12 at 10:02
  • 1
    I am not sure it is only servlet api version that makes the difference; although it is definitely important (e.g. annotations support). My understanding of "non-J2EE servlet containers" - to the extent of this context - is that in a J2EE 5+ environment such as JBoss AS 7, JAX-WS 2.0 support is guaranteed automatically, but if you need to create web services in other environments such as legacy servlet containers, you can still do the job and this is one option. Of course, today, there are some other good, even better implementations available (e.g Apache CFX) which you can choose from. – RGO Sep 28 '12 at 01:20
  • @JohnDoDo - here is one explanation about the difference between servlet container and full Java EE application server: http://stackoverflow.com/questions/17181292/java-ee-containers-vs-web-containers/17184620#17184620 – Miljen Mikic Jun 16 '15 at 07:32
  • Even in Glassfish Payara 4.1.1 the sun-jaxws.xml is needed. So I do not understand your answer. – insideout Nov 20 '17 at 13:56
  • is there any way we can specify port in sun-jaxws.xml endpoint configuration ? – user1887464 Aug 14 '21 at 15:35