I am not much familiar with RESTFul webservices. I need to develop some RESTFul webservice using axis2. But I am not able to find any material on this, even though I found some using Jersey.
It would be very helpful if someone could tell any tutorial or a simple example, so I can start.
Thanks Bill for reply and I do agree with you about using Jersey instead of Axis2 for RESTFul webservices. But I have to use axis2 and I need only XML type as return parameters.
So still waiting for someone to suggest some link for sample code or something which can help.
It is nothing to do with the choice of any tool, I said that because Bill mention that using Axis2 I can return only XML. But for me there is no choice, I have to use axis2 for that. I know axis2 is for SOAP web services but they claim it can be used to develop RESTFul web services as well, but I had no luck to find a sample code or something which can show the way to use axis2 to create a RESTFul web service. It will be great help if someone could tell such sample.
Author and all-around good cowpoke
I have gone through the example which you posted. But according to it I have to use WSDL 2.0 to develop REST web services, is there any way that I do not need to use WSDL 2.0, but I am willing to use WADL instead. I mean I do not want to use WSDL 2.0 for that. My requirements are like this. Thanks
Author and all-around good cowpoke
Joined: Mar 22, 2000
Your requirements have certainly put you in a box
WADL is not necessary for creating a RESTful web service. If you have to use Axis2, you are stuck with WSDL 2.0.
The big commercial services with RESTful architecture seem to depend more on text descriptions and source code examples to assist client development rather than WADL.
It's a little hard to answer this question because I don't have a lot of information about what you're trying to do. I'm guessing that you have some kind of data or resource that you'd like to present through consistent (and preferably clean) URI's?
If all you need is GET, you can use Axis2 pretty easily. Here's a link from the Axis2 website:
essentially, all you need to do is create a model class that represents the data you'd like to present, and then create a simple POJO that contains the methods you'd use to access this data. Axis2 will turn these methods into a web service. If it's just get, you can pass parameters to the methods through the URL, ie., like
Axis2 will take whatever the method returns (probably the model you defined to represent your output) and parse it into XML for you. Unfortunately, the URI isn't especially pretty (and contains request variables), and The default XML will contain a lot of axis-specific tags.
It sounds like Axis2 and REST are strict requirements for you - if what I described above is all you need to do and you had more flexibility with your approach, I think there would be better ways to go about it.
Joined: Feb 25, 2008
Hi Thanks for Reply,
I have been going through some articles and sample code for REST web services. So what I understood is that Axis2 has implementation of jax-WS, not jax-RS. But it does supports REST with some restrictions. So if REST needs to be implemented using Axis2 we have to use WSDL 2.0(which is very new). But Jersey has the implementation of Jax-RS so it is the better way to develop any REST web service.
Is that right? If yes, then I will go with Jersey to build REST web service. Thanks
Joined: Mar 22, 2005
Yes, Jersey is the proper tool for building REST services.