views:

436

answers:

5

hi everyone,

how hard is adding a basic web services interface to an existing java server application without having to turn it into a .war, or embedding a small web server like jetty?

say, xml-rpc instead of more modern approaches, if it helps.

if not too hard, can you suggest a starting point?

thank you in advance :)

A: 

I don't know what you are doing, but what about rmi?

RMI @ stackoverflow

Macarse
that was indeed our first attempt, but unfortunately for unknown reason a backward looking server-to-client connection (to the client random port, so to speak) is created at call time (we are not using callbacks, therefore we suspect it's all rmi low level stuff, maybe DGC??), connection we cannot get rid of.it's a real pity, but what the... , what's with that connection, weren't tcp connections already bidirectional? :(
Yes, RMI creates two connections. If you have firewall issues you can choose which ports to use.
Macarse
A: 

Spring-WS has the facility for using JRE 1.6's embedded web server, if that's an option for you. Spring-WS gives you a very nice SOAP server layer, if that's what you're after.

If not, then an embedded Jetty instance is probably the best idea.

skaffman
+2  A: 

It sounds like you're asking for the impossible: expose an HTTP service without plugging into or embedding an HTTP server!

Unless you want to reimplement what Jetty already does, I'd reccommend using Jetty as a library. That way you don't need to conform to the more awkward aspects of the Servlet spec. E.g. your servlets can have real constructors with parameters.

There is also a simple HTTP server implementation in JDK 6, but it's in the com.sun namespace so I'd avoid it for production code.

Nat
in the end we are going to refactor the architecture to make the application a .war style webapp, it's already modular enough. Though, embedded jetty remains a safety plan and i hope to toy with it as soon as possible, it seems a lot simplier once the basics are learned.thank you all.
+1  A: 

Check out the Restlet API which provides a painless way to implement RESTful web services that can run inside a web container or standalone.

Henning
A: 

Apache has an implementation of XML-RPC at http://ws.apache.org/xmlrpc/server.html. If you look at the examples at that link you will see it is rather easy to integrate into an existing server application.

Clint