I am not familiar with websrvices and mysql ..i followed this http://www.vogella.com/articles/REST/article.html tutorial and developed a RESTful web service in Java with the JAX-RS reference implementation Jersey.
I want to create an websrevice using eclipse which select the data from mysql database and display the result in xml format.
I got lots of sample developing webservices with PHP and mysql but i want to develop in java.
Please suggest me some good tutorial/links on this or idea which may help me. i want to use that webservice in my android application.
In the above example ,i am not getting where to put the connection string to establish the connection between MySQL database and java files.
Here is the TodoResource.java :
package de.vogella.jersey.jaxb;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import de.vogella.jersey.jaxb.model.Todo;
@Path("/todo")
public class TodoResource {
// This method is called if XMLis request
@GET
@Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
//@Produces( { MediaType.TEXT_XML })
public Todo getXML() {
Todo todo = new Todo();
todo.setSummary("This is my first todo");
todo.setDescription("This is my first todo");
todo.setMy_id(1);
return todo;
}
// This can be used to test the integration with the browser
@GET
@Produces( { MediaType.TEXT_XML })
public Todo getHTML() {
Todo todo = new Todo();
todo.setSummary("This is my first todo");
todo.setDescription("This is my first todo");
return todo;
}
}