我有一个JAX RS Rest服务,其请求类如下
@XmlRootElement(name = "CDSRequest")
@XmlSeeAlso({MyClass.class})
@XmlType(name = "CDSRequest", propOrder = {"data", "refClass"})
public class CDSRequest {
Object data;
Class refClass;
public Class getRefClass() {
return refClass;
}
public void setRefClass(Class refClass) {
this.refClass = refClass;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
当我使用上面的请求对象进行REST调用时,我得到以下错误。我怀疑数据的通用对象类型的问题。但我认为**@XmlSeeAlso**
会解决它。请帮忙
javax.ws.rs.BadRequestException: HTTP 400 Bad Request
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(AbstractClient.java:426)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.checkResponse(ClientProxyImpl.java:290)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:585)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:551)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:205)
at com.sun.proxy.$Proxy93.pushRawData(Unknown Source)