JAX-RS without container - java

This may sound like a strange request but is it possible to have a RESTeasy - jax-rs application without a container?
The reason I'm asking this is because I need a browser extension and some java code to communicate efficiently.
I have thought about sockets but that would leave me with the job of implementing all the communication details.
I have tried liveconnect but that does not work outside of the embedded applet world.
So I'm left with webservices.
The thing now is that the browser extension is launching a jnlp that should start the java application I really would prefer not to have the main() instantiate a jetty browser...
Any ideas are welcome!
Thanks in advance

For those who wish to have information about embedded container with RestEasy library, check that : http://docs.jboss.org/resteasy/docs/3.0-beta-3/userguide/html_single/#RESTEasy_Embedded_Container

Related

Java Webservice - Expert Know How

I have written an axis2 java webservice. This service works perfektly on a Apache Tomcat
Please let me know if it is possibly to make some tasks in a webservice automatically.
Is there any technical solution available to combine a webservice and a normal java application in one component?
For example the application has some functions which are reachable as webservice and on the other side the application listen for new sockets or do other stuff beside the webservice functions
So it is a application with a Web service inside. .
Thanks for your expert know how. ..
BR
SO is really not meant for recommending tools but what you need is an "embedded servlet container". There are a couple to choose from. The first is Jetty http://www.eclipse.org/jetty/ also take a look at "embedded Tomcat"
Instead of using an embedded servlet container you could keep the whole thing running in tomcat but implement a ServletContextListenter that runs on startup that you could start your socket listeners in.

Java program to a web service\servlet

I've written a java program that handles certain http requests.
Now I'm asked to run this as a web service in IIS.
I've tried to export it as a jar and maybe run it like that...but I didn't succeed.
As far as I understood, I need to re-write the program as a web service or servlet and upload it this way to IIS.
My question is, how to do it (I'm using eclipse)? So far I managed to run a server but I never couldn't make my program to work. Can I have guidance please?
This is pretty old article but you can take a look here
For new IIS I'm not sure you can because Microsoft has it's own tech called .NET so I suppose it's better to use other server or use .NET
Also you can use Tomcat connector for IIS which is filter with redirect

Java-ws tomcat invoke methods through http?

I made a web project in Java, using Java-WS.
How can I invoke service methods through HTTP only.
I don't want to generate (or worse write) any java web clients, and similar stuff.
I'd just like to invoke the method with a HTTP request.
And parse the result (manually) from response.
In .NET web services I invoke methods just with:
http://serviceUrl/serviceName.asmx/operationName?parametars=...
How to do the same thing in java + tomcat?
Edit: Let me rephrase my question.
So this is what I have done so far:
Created a web application (btw. using NetBeans IDE)
Added all the necessary source files
Added web service classes with WebMethods defined
I deploy the app on tomcat and it deploys fine.
Now, what do I need to do to be able to invoke my WebMethods via HTTP?
Typing:
http://localhost:8084/MyService/MyMethod
doesn't work.
Sorry if this is a stupid question, but I'm not really a Java guru, I've been working mostly on .NET.
Multiple possibilities:
use new URL(url).openConnection().getInputStream()
use apache http components
use a REST client (if you invoke restful services), like http://code.google.com/p/rest-client/">this, or these. Or spring's RestTemplate
In this case, if you want to do an HTTP Web Service that returns an HTTP 200 Web Response, why not look at doing a RESTFul application?
JavaWorld briefly explains the role/use of REST. There's been similar questions on REST tutorials in SO. I hope this helps you.
Apache CXF has a 'plain http binding', but we recommend that people write JAX-RS services, instead. They are very, very, simple. However, the plain HTTP binding is there and supports GET.
I generate a RESTful Web Service in NetBeans by clicking on "Generate SOAP-over-HTTP Wrapper" in my service context menu.
It generated successfully, compiles and deploys fine.
But I still can't figure out how to make a HTTP invoke

WCF Self-Hosting capabilities in Java

Hi guys is there a way to self-host a web service in Java just like WCF?
Jersey using Grizzly embedded within it would seem like a good fit for your needs. It wouldn't require and outside application server and would be fairly lightweight to get setup. You can just read the Jersey getting started documents to get going with that exact path:
Jersey User Guide
If by self-hosting you mean generating a web service endpoint for invocation, there are a number of ways to go on this, depending on your potential deployment environment.
I'd start off looking at Oracle's JAX-WS implementation, which includes RESTful capabilities. If you want to run a relatively simple stack, you could use Apache Axis2. And then JBoss has JBossWS, which can run standalone or in the JBoss Application Server. I'm pretty sure most of the major application server engines have a Web Services component as well.

java: basic web service interface without a web server

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 :)
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.
Check out the Restlet API which provides a painless way to implement RESTful web services that can run inside a web container or standalone.
I don't know what you are doing, but what about rmi?
RMI # stackoverflow
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.

Categories

Resources