Hi,
In one of my services in the webservice I have to return an array of objects. I am using Axis1.1 and Tomact6.0 and developing code using eclipse 3.4.1 and JDK5.
Here is my sample code
This is what my web service has
public class WebLibSvcs {
public List<DocumentInfo> getAllDocuments(BigDecimal workflow_id) {
boolean statusWL = WLGlobalVar.getInstance().isDctmWLRun();
logger.info("Status of WebLibrary: " + statusWL);
WebLibSvcAction callSVC = new WebLibSvcAction();
List<DocumentInfo> results = new ArrayList<DocumentInfo>();
results = callSVC.getAllDocumentsImpl(workflow_id);
return results;
}
}
Implementation class:
public class WebLibSvcAction {
public List<DocumentInfo> getAllDocumentsImpl(BigDecimal workflow_id) {
List<DocumentInfo> result = new ArrayList<DocumentInfo>();
try{
DocumentInfo docInfo = new DocumentInfo();
for (int i = 0; i < 5; i++) {
docInfo.setObject_name(“test”);
result.add(docInfo);
}
}catch (ServiceException e){
e.printStackTrace();
}
return result;
}
}
Bean Definition:
public class DocumentInfo implements Serializable{
public String version_label;
public String title;
public String object_name;
public String subject;
public String linkUrl;
public String getVersion_label() {
return version_label;
}
public void setVersion_label(String r_version_label) {
this.version_label = r_version_label;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getObject_name() {
return object_name;
}
public void setObject_name(String object_name) {
this.object_name = object_name;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
}
Error I am getting:
The service class "com.service.WebLibSvcs" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
The method "getAllDocuments" on the service class "com.service.WebLibSvcs" uses a data type, "java.util.List", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.
similar errors are coming for ArrayList and Object.
Please help me on how to resolve this issue.
The main business logic behind method is I have to run DB qry and return results. That the reason I am trying to create bean object for eachrow and return them as array.
Thanks
MSU