tags:

views:

626

answers:

7

It is possible to deploy my own created web service to any of PC without installing any web server app eg:tomcat? I want make it like agent/plug-in in any PC. In order to access the web services i only need to access http://:8080/web_service. Any suggestion about this?

+3  A: 

Take a look at Jetty, a very light servlet container

Ben
+1  A: 

I think Spring web services can be configured to run in a "fake" web server as well - there is a discussion on this on spring web services forum for sure (I needed the same thing, but ended up using a web server due to other issues)

laura
+10  A: 

Even lighter than running Jetty you can use the HttpServer built into Java.

http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/package-summary.html

You'll need to write your own code for parsing request data but it's certainly doable.

http://blogs.operationaldynamics.com/andrew/software/free-java/sun-secret-webserver.html

pjp
+3  A: 

Take a look at Apache CXF. It can use jetty for stand-alone web-services. It integrates with Spring which makes it easy to add a web-service simply as spring-bean with very little additional code.

Wolfgang
+2  A: 

You mention Tomcat as an example of what you don't want to do, but Tomcat can be run in embedded mode, where it gets started up from inside your application:

http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/startup/Embedded.html

Saying that, I'd recommend Jetty, it's more light-weight than Tomcat.

skaffman
+3  A: 

You will need something listening for a http connection. Fortunately Java 6 has all you need in the default runtime.

Have a look at:

http://hofmanndavid.blogspot.com/2008/11/easiest-way-to-publish-java-web.html

Thorbjørn Ravn Andersen
A: 

I've been following this pretty basic tutorial, and it does just what you want

http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/

It seems like the Java SE 6 platform has a small web application server that will publish the web service while the JVM is running.

opensas