I have a java application which doing some logic... ...
But the java application is only a .jar application. But I would like to let it become an application on the web....I can get the param from the user, but how can I pass the param from user, and put it into my .jar, and process and output the result to the user??
notice that the .jar application is only a console application, which don't need a user interface, only cmd lines communicated with it. Thank you.
Do you have source code? If you do, you can expose the services using JAX-WS annotations. JAX-WS is available in J2SE6.
Take a look at this: http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
You then have to package the modified code to a WAR instead of a jar, because your application now becomes a web application. Then it will have to be hosted in an application server - Tomcat for example.
You may take a look at Metro.
Related
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.
Currently Learning Web project in Java. I have a doubt related to it.
Actually I have a task that, access method of Dynamic projects using JBOSS Server through web services.
Initially I didn't get what I want to do.
After learning some things related to it, I thought that If I run my project on JBOSS, then how can I access the methods of it? How to create the web service and how to use to it?
Or is it like that If I run my project on JBOSS server then is methods directly accessible?
Thats why I thought If I am able to create the object of class which is running on JBOSS server then may I can access the methods.
Please advice me on this.
You mentioned application.wadl file. WADL or Web Application Description Language is used to define a contract interface for RESTful web services. Please refer to the links for more information.
Now your problem boils down to :
How to invoke the method of an object exposed as RESTful web service.
Now you already have wadl file with you. Please have a look at a tool called wadl2java. This tool will consume your Application.wadl file and generate java stubs. You can use these generated java classes to invoke the methods on the object deployed in JBoss server.
The way you are calling it
localhost:8080/proj-name/<#PATH-name in java stub or module name>/method name
is correct, if services is working fine for you initially, you can modify the path by editing in web.xml or path annotations in your java classes.
I'm new to webservice development. I'm using Netbeans 7.0 with the Axis2 plugin and Tomcat 7.
I have a server application that is just a bunch of web methods with no UI or anything, and I created it pretty much following the tutorial at http://netbeans.org/kb/69/websvc/gs-axis.html. I use the Axis2 plugin to deploy to Tomcat.
So when I created my server application, there is no main method or anything. Typically if I want to log to a log4j log file, I'd put something like this in my main method to define where the config file for log4j resides...
PropertyConfigurator.configure("./conf/log4j.properties");
I do this on the webservice client and it works just fine, but of course that has a main method. So where would I put it in a webservice server application that has no main method? I know it doesn't have to be in the main method, but it has to be in some block of code that I know will execute, and I can't really guarantee which of my web methods will be executed first, so I can't really just stick it in one of my web methods.
I did check out other posts on StackOverflow, but didn't really find any that describe what to do in this scenario.
Anyone know the right way to do this?
I would use a ContextListener:
http://www.java2s.com/Tutorial/Java/0400__Servlet/SetServletContextListenerinwebXML.htm
My java application uses swings and makes a connection to the MySQL database. I want to run this application as a windows service which should start immediately at the logon of any user.
I think Java Service Wrapper is useful only for console applications.So kindly suggest me a suitable method.
Thanks for the help!!!
You don't want to have apps with user interfaces as services. Services can start at boot, and if they pop up a panel, they can hang the service waiting for user input with no user to provide any input. Split out the UI from the service code if you want to run the code as a service. Or like Andy mentioned, place the exe in the users startup group.
If you want to create a Windows service, Exe4J makes this easy. It will wrap your Java application in an executable that supports options to install, start, stop and remove it from Windows services.
If you want to start a user interface at the start of a user's logon, you can put the application into the Startup group.
The binaries (e.g. tomcat6.exe, and tomcat6w.exe) that are included with Apache Tomcat can be used to turn a java application into a service. Here's a link to the documentation, which includes instructions for installing your app as a service, etc.: Tomcat as a Windows service
http://kenai.com/projects/winsw works great, and allows easy logging of System.out and System.err.
Used in Glassfish v3.
I create a simple SOAP web service and I want to consume it using java applet....meanwhile I'm not sure if that is possible or not. so my question is how to add this applet in HTML page and make it consume the web service also. Does I have to take the web service generated sources and put them some where or I have to modify my normal applet tag.....
There is no need to treat the generated source files any differently than your regular source files. Simply copy the generated source files into your current project.
It is possible...it is like using it from a normal swing application cause you do not access local resources from the hosting computer.
Just bundle client code ...and will work.
I assume SOAP call is to a machine NOT different than that supplying the applet