4

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 :)

user120747
  • 169
  • 1
  • 8

4 Answers4

2

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
  • 9,820
  • 3
  • 31
  • 33
  • 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. – user120747 Jun 16 '09 at 16:25
2

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
  • 16,063
  • 3
  • 51
  • 65
0

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

RMI @ stackoverflow

Community
  • 1
  • 1
Macarse
  • 91,829
  • 44
  • 175
  • 230
  • 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? :( – user120747 Jun 16 '09 at 06:23
  • Yes, RMI creates two connections. If you have firewall issues you can choose which ports to use. – Macarse Jun 16 '09 at 13:55
0

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
  • 398,947
  • 96
  • 818
  • 769