axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith <keithgchap...@gmail.com>
Subject RE: REST Services
Date Sun, 20 Apr 2008 13:23:47 GMT
Hi all,

I have attached a sample POJO service hearwith that demonstrates the
REST capabilities of Axis2. (This is a sample that I used at an Axis2
training recently).

It has 3 simple methods
public void registerStudent(String name, int age, String[] subjects)
public Student getStudent(String name) throws StudentNotFoundException
public Student[] getStudents()

all these methods can be accessed via get and POST by default.

here are the URLs for GET (assuming the server is running on port 7762)

http://localhost:7762/services/StudentService/getStudents
http://localhost:7762/services/StudentService/registerStudent?age=26&name=keith&subjects=math
http://localhost:7762/services/StudentService/getStudent?name=keith

Note that i have added data also using a GET which is not a good
practice. I was just trying to show how multiple params can be sent on
the URL. If you need more control of the URLs thats also possible in
Axis2. But you will have to use WSDL 2.0 based deployment. With WSDL 2 I
could have exposed the getStudent operation at a URL such as
http://localhost:7762/services/StudentService/student/keith

Note that in this case keith is a parameter and it was sent on the URL.
I will be writing an article on this soon and it will be available at
wso2.org. Will send a note to the list when its published.

Please let me know if you need more help. Hope that this sample explains
to you how you can write and invoke REST services  easily in Axis2.

Thanks,
Keith.

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message