views:

439

answers:

2
+1  Q: 

Servlets + JAX-WS

Hi All:

I'm trying to expose a web service method via JAX-WS annotations. Many examples I've seen reference the EndPoint.publish() method to quickly stand up the service in a standalone app (ex from Java Web Services: Up and Running, 1st Edition):

public class TimeServerPublisher {
public static void main(String[ ] args) {
  // 1st argument is the publication URL
  // 2nd argument is an SIB instance
  Endpoint.publish("http://127.0.0.1:9876/ts", new TimeServerImpl());
}

}

One thing that I'm missing is how to accomplish essentially the same thing but in an existing app. Would I make a servlet to handle this? What is the proper way to publish this service in an existing WAR file?

+1  A: 

In a container you don't have to publish like this. The container will do the publish. If you plan to use it in JBoss server try JBossWS otherwise for Tomcat or any other server Axis2 may be the better choice.

Read more from the following links.

http://jbossws.jboss.org/mediawiki/index.php?title=JBossWS

http://ws.apache.org/axis2/

Jerrish Varghese
Or CXF: http://cwiki.apache.org/CXF20DOC/servlet-transport.html
Maurice Perry
Yeah, I missed CXF :-)
Jerrish Varghese
+1  A: 

This depends on what WS stack you are using.

If you are using Java 6 then that includes the JAX-WS reference implementation, then you can consult the documentation about JAX-WS RI WAR contents.

andri
Your link to the reference implementation does not work. It should be https://jax-ws.dev.java.net/
Steen