views:

273

answers:

8

Basically I need webservice where client can request with id one boolean value from our webservice. What technology would be most suitable for this small API? Of course it is possible that there will be more functions to interface, but now we need only one function. It also needs to have authentication, so that only auhtorized clients can access service. And every client have different auth credientials.

What would be good technology for this purpose?

+1  A: 

I am using resteasy to build my webservices and it is pretty easy to use ... just need to use annotations on my methods to deliver the webservices.

Here is a comparison of different JAX-RS frameworks. Take a look at it

Diego Dias
A: 

You could use some restful framework like jersey.

The MYYN
A: 

Given that you tagged your question as "Java", I suggest Jetty. It is a very good small servlet engine. It has support for sessions, so adding authentication should not be a problem.

Marcin
+1  A: 

First of all: authentication and authorization. Don't do it yourself, pick an app server or servlet container and configure it to do the job.

For the web service....

The simplest thing to do it just implement a servlet that responds to a POST (not a GET if request modifies internal state) and returns the result in the body. This way you don't need any frames works, no learning to do (if you already know servlets). The downside is it won't scale as you add more features, and your not using enough buzz words.

If you want a SOAP based webservice, then look at JAX-WS. Now that it's backed into java 6 it's pretty easy.

At the simplest level JAX-WS lets you put a few annotations on your class, like @WebService, and it auto generates a wsdl and exposes an instance of your class via the web service.

There is plenty of documenation out around how to do it:

David Roussel
+1  A: 

JAX-WS + any servlet container (Tomcat is usual choice)

@WebService(targetNamespace = "http://affinity.foo.com", name="RewardsStatus")
@SOAPBinding(style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.LITERAL)
public interface RewardsStatusIF {
    @WebMethod(operationName="GetLastNotificationDate", action="urn:GetLastNotificationDate")
    @WebResult(name="return")
    public Date getLastNotificationDate() throws AffinityException;
...

Actually, you don't even need a servlet container. JAX-WS has a way to run the service under a standalone Java application. It has some limitations (I have failed to make a stateful service work), but it's very simple to create.

Vladimir Dyuzhev
To use the @WebService annotation with Java 5 you'll also need the JSR 181 implementation. If you use Java 6 it's included, and so is JAXB. I guess what I'm trying to say is: you either need Java 5 plus JAXB and JSR 181 or Java 6.
Fabian Steeg
Also I'm wondering: to actually make this do something, don't we need JAX-WS?
Fabian Steeg
Well, yes, sure, it should have been JAX-WS. Typed in hurry.
Vladimir Dyuzhev
Java 5 is being replaced with Java 6 everywhere I see. So it's not an issue anymore.
Vladimir Dyuzhev
A: 

If you are using Java 6, there is already a HTTP Server builtin, it supports Http authentication. That's all you need. Check out,

com.sun.net.httpserver

ZZ Coder
A: 

An alternative to SOAP-based web services with JAX-WS would be JAX-RS (for RESTful web services).

Fabian Steeg
A: 

We have a lot of scenarios on our project where we want small amounts of data available via simple HTTP URLs while the app is running and in my experience, Restlet (http://www.restlet.org/) seems to be one of the easiest things available for setting up simple "web-service"-like interfaces (RESTful interfaces) within Java apps.

Brent Nash