Skip to main content

Jersey along with JAX-WS

No replies
Joined: 2013-06-12
Points: 0

Hi All,

I am trying to create a RESTful webservice using Jersey implementation.

Simultaneously I have the JAX-WS implementation for the webservice.

I have the java beans which have been generated using the xsd. I wish to reuse the same java beans for RESTful webservice.

The GET method works fine for me but if I try to implement a POST method, I am getting issues accepting the json string as java bean and the code breaks.

for instance:

my java bean:
package ws.test;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;


public class VivekRESTClass {

public VivekRESTClass(){


public VivekRESTClass(String id,
List product) {
super(); = id;
this.productType = product;
protected String id;
protected List productType;

public String getId() {
return id;
public void setSessionId(String id) { = id;
public List getProduct() {
return productType;
public void setProduct(List productType) {
this.productType = productType;


while my REST ful class looks like:

public class VivekRESTClassImpl{

private static final Logger logger = Logger.getLogger(VivekRESTClassImpl.class);
public VivekRESTClassOutput addCartLine(VivekRESTClass vivekRESTClass){


Now when I invoke my method using REST client, I pass a json i.e.


Ideally the json passed seems to be converted to java bean and then I can use the bean to get the values but now this is not happening.

I wonder if there is some configuration that needs to be done so that Jersey can work fine with the JAX-WS.

Any help will be appreciated.