Hello,
I'm presently trying to implement a Web Service which exposes a class
with recursive/circular data references (see the code bellow).
When I'm calling the method testRecursive I got a "Stack Overflow
Exception" on the server side.
How can I represent circular/recursive references using JAX-WS?
François JEAN
package com.cardinal.ws.server;
import java.io.Serializable;
public class ClassA implements Serializable {
private static final long serialVersionUID = 1L;
private long id;
private ClassA a;
public ClassA getA() {
return a;
}
public void setA(ClassA a) {
this.a = a;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
@WebMethod
public ClassA testRecursive() {
ClassA a1= new ClassA();
ClassA a2= new ClassA();
a1.setId(0);
a1.setA(a2);
a2.setId(1);
a2.setA(a1);
return a1;
}