wood burning stoves 2.0*
The moose likes Web Services and the fly likes JAX-WS and Servlet2.4 web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS and Servlet2.4 web.xml" Watch "JAX-WS and Servlet2.4 web.xml" New topic
Author

JAX-WS and Servlet2.4 web.xml

chatchai chailuecha
Greenhorn

Joined: Dec 14, 2006
Posts: 18
Hi everybody,
I am trying to find a way to create a JAX-WS package which is portable over JavaEE container. I have created a simple webservice starting from java source below.



I used wsgen(in JDK6)to generate all ws artifacts and my final war package looks like this
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/news/
WEB-INF/classes/news/jaxws/
WEB-INF/classes/news/jaxws/GetLatestHeadline.class
WEB-INF/classes/news/jaxws/GetLatestHeadlineResponse.class
WEB-INF/classes/news/NewsFeed.class
WEB-INF/lib/
wsdl/
wsdl/NewsFeedService_schema1.xsd
wsdl/NewsFeedService.wsdl

There was no web.xml, no webservices.xml or any server specific deployment descriptor. It should be auto-generated from the annotation in NewsFeed class

I deployed the package just like a normal java web application and Sun Java System Application Server 9.1 nicely detected the annotation and report that I had a NewsFeed web application and NewsFeed webservices in my system (It presented on web console).

My problem is that when I add a web.xml to the package and deployed it.

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

</web-app>

SJS9.1 couldn't detect the annotation; I got only the NewsFeed web application but no web services. I can resolved it by changing the web.xml to use servlet2.5 declaration.

My guess is that servlet annotation(e.g injecting resource to servlet) has been introduced in servlet2.5 so when the container found a web.xml with servlet2.4 declaration somehow it didn't bother to scan for any annotated class. The side effect is that the @WebService hasn't been detected.

I have tried the package with servlet2.4 web.xml with websphere and it worked just fine so I am not sure this is the implementation problem in Sun application server or not.

Are there any part in JAX-WS, JSR181, JSR109 specification or any document state something about how a Java EE container should discover the webservices annotation?

Thanks very much

Chatchai Chailuecha
www.devguli.com
[ January 21, 2008: Message edited by: chatchai chailuecha ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX-WS and Servlet2.4 web.xml