Hi All I was trying to create a rest web-service from scratch. Here is my Service part
@Path(\"/Phones\")
public class PhonessResource {
@GET
@Produces({M
For Xml, if you have all the dependencies that come with Jersey, it should work out the box for the client API. You might not have added all of them. I see you aren't using Maven, which I would strongly advise doing. But I'll provide both way to handle this.
Maven:
Only dependencies you'll nee to get the client up and running (with JAXB xml support)
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.13</version>
</dependency>
Doesn't get much simpler :-)
Non-Maven:
So using a Maven project, I added the above dependency, and these are all the transitive dependencies it pulled in. In your non Maven project, you will need to manually add all these jars.
If you go to the Jersey Hompage, go to Downloads, and download the "Jersey JAX-RS 2.0 RI bundle
. You should find all these dependencies in there. You should add all the ones needed, into your project
Note: Netbeans already comes with the Jersey 2.0 (JAX-RS RI)
library. You could instead simply add that library to your project. Just right click on the [Libraries] node in your project, and select [Add Library]. You should see the Jersey in the dialog. This solution is probably the easiest, but it will import all the Jersey dependencies, more than is required for the client API
JSON requires another dependency:
Maven:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.13</version>
</dependency>
Non-Maven
Have a look at this post for an image and further explanation.
Just having these dependencies on the classpath should work, without any special configuration.