0

I used to saw a tutorial about this topic. But when I try to make my example application by following the example. I can't find com.sun.xml.ws.transport.http.servlet.WSServletContextListener on my classpath. but I found com.sun.xml.internal.ws.transport.http.servlet.WSServletContextListener It confused me, why Oracle move those classes in com.sun.xml.xxx to com.sun.xml.internal? I am using JDK1.6.0_45. I saw some people said, form JDK6U4, jax-ws reference implementation is bundled in JDK, so we should be able to publish a web service by running a light weight http server just with JDK and no other dependencies needed, is that ture? You should notice that in the tutorial I mentioned above, additional dependencies is still needed, see step 5 "JAX-WS Dependencies".

And I also found that in IBM JDK, even com.sun.xml.internal.ws.transport.http.servlet.WSServletContextListener can't be found.

Community
  • 1
  • 1
CaiNiaoCoder
  • 3,269
  • 9
  • 52
  • 82
  • That tutorial you linked is based on a glassfish implementation of JAX-WS, [Metro](https://metro.java.net/guide/). Vanilla JDK doesn't ship with `WSServletContextListener`, that's strictly JavaEE. If you're looking at building a web service without a web app server, [try this](http://stackoverflow.com/questions/12860588/java-web-service-without-a-web-application-server) – kolossus Jan 27 '15 at 16:24

2 Answers2

1

Yes, JAX-WS RI (same as JAX-B RI) is shipped with JDK since Jdk6. All the packages except for javax.xml.* are changed to .internal. in order to avoid conflicts between JDK's and standalone JAX-WS versions.

Using JDK's version, you can deploy web service using just JDK; if you want deploy WS in tomcat or in some AS, you still need JAX-WS standalone version.

miran
  • 1,419
  • 1
  • 12
  • 26
0

If you check grepcode for (non-internal) WSServletContextListener, it shows you, the class is shipped with jaxws-rt/webservice-rt jar.

By looking for the internal WSServletContextListener, you can't find a jar shipping it. (but grepcode also contains the sources of openJDK)

Also, I tried to find WSServletContextListener in my local jdk7, but can't find it. But maybe some third-party jdk ship with the class.

Anyway, if you look into the tutorial again, you will find that jaxws-rt.jar is necessery for the application. Probably you should add it?

Martin Baumgartner
  • 3,524
  • 3
  • 20
  • 31