I need to do some performance tests of my web service, in fact it is a simple servlet. I'm using GlassFish 3.1 but i can switch to Tomcat. Could you give some advices and tools names which i can use to do these tests?
We use the open source jmeter tool quite a lot. Here is the project page: http://jmeter.apache.org/
I would recommend SOAP UI as the best tool for testing SOAP web services.
If it's a REST service, you can use any client that can make an HTTP request to a URL. You can use java.net.URLConnection to do that.
I don't see how GLASSFISH or Tomcat matter here. Both have compliant servlet engines.
Related
I'm trying to develop a small server which would include one restful webservice.
I'd like to use JAX-RS for the webservice part, but every example I'm seeing is using a tomcat server, and I can't use any 'application' server (meaning I can create a server in my code, but can't run it from the outside).
Well anyway I was wondering if anyone had any sample to show, and any advice on which light library I could use to run such a simple server into my code (can't use any gpl /lgpl etc licence, so no jersey for example).
Thank you.
It's possible to embed Tomcat in your application, see here for an example: http://java.dzone.com/articles/embedded-tomcat-minimal
Another popular choice for an embedded servlet container is Jetty, they have a tutorial here.
Edit
The examples provided with Jersey can also be helpful, here's one for running using the Grizzly HTTP library: https://github.com/jersey/jersey/blob/master/examples/helloworld/src/main/java/org/glassfish/jersey/examples/helloworld/App.java
You can even use the HTTP server that's bundled with the JDK (probably not the way to go for a real application): https://github.com/jersey/jersey/blob/master/examples/helloworld-pure-jax-rs/src/main/java/org/glassfish/jersey/examples/helloworld/jaxrs/App.java
Have you checked out http://www.sparkjava.com/?
It's very light-weight and concise.
Building a server into code is nothing. See "Embedding Jetty", for one. There are plenty of other options with varying degrees of difficulty and capabilities, like the Simple Framework, Tomcat, Grizzly, Netty, and Vert.x, to name a few. Then, if you're not stuck with Java, the language, there's Ratpack for a lightweight REST server. Otherwise, running something like Jersey in an embedded server is quite simple. I do it every day in tests.
I have Used Tomcat Apache to use my java desktop application as a webservice.so is that good option Or i need to use apache server to make my java application as a webservice?
Wht i want is after my webservice made with apachetomcat ..can i call that webservice with wcf or desktop application of .net?
wcf service -> call webservice of java application(using apache tomcat) ->execute java application on server->and return resutl to wcf service
wcf service has function as below
call Javaapplication();
and throught that can i invoke java programm on server?
is it possible?
Apache is an http server. Tomcat is a Java EE environment which includes the ability to function as an http server.
Apache alone won't run your Java application. In many cases, Tomcat will be enough, but in higher-volume situations, you may want to use Apache and Tomcat together.
Other than that, it looks like you need to find a good tutorial on Java EE and Web Services, like, perhaps, this one by Oracle
If you are looking at Apache products, Axis is the tool for web services. And to that, I would look at Axis2. But, I would encourage you to look at the variety of options out there and select the best for you.
I am looking to use Jersey without the need of installing an application server such as Tomcat or Glassfish. Ideally I would like to create a lightweight program that listens on a port and allows connections. I believe you can do this with Grizzly + Jersey but I am not sure how easy this is, because from my understanding Grizzly is used to write new http servers from scratch?
Restlet looked good in this regard because it included an internal http server but the documentation provided is extremely meager.
You can use a light-weight servlet container like jetty. you can bundle and ship this with your application. Also building and shipping jetty with your application is very easy.
I've deployed an app recently that uses embedded Jetty in Spring to launch Jersey, so this is 100% possible. Jersey, in fact, has a SpringServlet for easy delegating to a Spring context based REST implementation. If you have additional questions down this route, let me know. It wasn't the most straight forward, but I can talk you through some of it with the appropriate links.
I need a very performant and scalable solution to calling web services from java webapp.
Could someone please suggest the best options for calling webservices from java webapp?
Much appreciated
If you are using a restful web service, there are a lot of client libraries which you can choose. Eg. RestEasy Client, Jersey Client,....
I'm new with Restful Web Services and got some questions about some of the requirements needed to create one.
1) I got only Apache2 installed on machine and I can't install any EE Server. Is it possible in this circumstances create Restful Web Service? What is better in my case Axis2 or JAX-WS?
2) I want to make the content of some file accessible to Internet, so I need to create the function which is going to be called by client and return for example XML from file? Is there any way to share directly the files using URL mapping?
Thanks a lot!
1) you can't install any EE Server, OK. If you can install Apache Tomcat, use mod_jk so that Apache can redirect some requests to Tomcat. In this case you can use Apache Axis2, Apache CXF or METRO (mainly SOAP services) or Jersey (for RESTful services). On the other hand, if you can't install tomcat, try PHP with Zend Framework to develop web services;
2) with RESTful web services you can return any resource (a file content) to the user using XML or JSON.
Best regards,
Romualdo.