Java Webservice - Expert Know How - java

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.

Related

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

JAX-RS without container

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

Creating a simple web page using Java without using Servlet and Tomcat

I want to create a simple server application which runs on the desktop, and when I type my ip and port on the web browser, it connects to the server client which then opens a webpage with appropriate displays coded on the server application.
I read online that I need to use servlet and Apache Tomcat to make a webpage using Java.
I am wondering if there are any easier way to make a simple webpage which can contain buttons without using servlet and Apache Tomcat?
For example, I can use sockets to communicate between server and client applications. Could I change this client into typing the ip address and port on the web browser which will display a webpage created and contained in the server application and remove the need for servlet and tomcat? If so, how do I create a button on the server application so that web browser can see the button when connecting to the server application?
Thank you very much.
If I understand you correctly, you want to have a web page, but you don't want to use Tomcat (or any other servlet engine).
Although it is technically possible to write your own little web server (using server sockets etc), but what you're basically doing then is rewriting Tomcat. Writing a good web server is a daunting job, and should not be taken lightly. I think you are underestimating that. Instead, use what is already there. Tomcat is really quite easy get running.
Creating the server piece could be done with raw sockets, but I would look at at an embedded server like Jetty. I think it will save you a lot of time and headache.
http://docs.codehaus.org/display/JETTY/Embedding+Jetty
You should look into Play Framework. It will be easier then implementing Tomcat or Apache.
Version 1.2.4 is stable and feature-complete for Java, version 2.x is focused on Scala and doesn't have all the features of 1.2.4 yet.
You don't have to create a servlet. But, you need something that can parse a jsp page - it could be tomcat or some other server which has the same capabilities as tomcat. Though I am not sure if I understood your question correctly.

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

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