1

I need to return a collection to calling client from REST webservice,

I did a wrapper something like below,

**

  • bean Wrapper

**

    public Collection<FundBalanceSetProperties> getVal() {
        return ListN;
    }

    public void setVal(Collection<FundBalanceSetProperties> list) {
        // TODO Auto-generated method stub
        this.ListN = list;
}

I tried to get the value set as below,

**

  • REST Service

**

@GET
@Produces({ MediaType.TEXT_XML })
public Todo getHTML() throws Exception {
    Todo todo = new Todo();
    Collection<FundBalanceSetProperties> list = myDal.getFundBalanceSet(null, null,
            null, null, null, null);
    todo.setVal(list);
    return todo;
}

But I am getting error

"Exception in thread "main"

com.sun.jersey.api.client.UniformInterfaceException:"

Can someone please help me with returning collection to calling client?

Bhesh Gurung
  • 50,430
  • 22
  • 93
  • 142
Learner
  • 2,303
  • 9
  • 46
  • 81

1 Answers1

1

The two easy options you have are:

  1. Return an Array (FundBalanceSetProperties[]) instead of a Collection
  2. Use Jackson: How to reuse Jersey's JSON/JAXB for serialization?
Community
  • 1
  • 1
Dan Hardiker
  • 3,013
  • 16
  • 19