问题描述
我写了一个像下面这样的网络服务。它将获取所有用户 ID 和用户名的列表。
@WebMethod(operationName="GetUserList")
public ArrayList<ArrayList<String>> getUsers() {
ArrayList<ArrayList<String>> result_t = new ArrayList<ArrayList<String>>();
System.out.println("=====Start fetch UserDepID=====");
DataSource tDataSource = null;
Connection tConnection = null;
Statement tStatement = null;
ResultSet tRs = null;
String orgID = "";
System.out.println("~~~~~~~~~Start getorgID~~~~~~~~~~");
try {
tDataSource = getJndiDataSource("java:/DS");
tConnection = tDataSource.getConnection();
tStatement = tConnection.createStatement();
String tsql = "select id,userName from Users where leaveDate is null";
System.out.println("sql " + tsql);
tRs = tStatement.executeQuery(tsql);
while (tRs.next()) {
orgID = tRs.getString(1);
System.out.println("orgID " + orgID);
ArrayList<String> line=new ArrayList<String>();
//
line.add(tRs.getString(1));
line.add(tRs.getString(2));
result_t.add(line);
}
System.out.println("Query End");
} catch (Exception e) {
e.printstacktrace();
} finally {
this.closeDB(tBPMConnection,tBPMStatement,tRs);
}
return result_t;
}
在wildfly服务器上部署成功。但是当我尝试在soap ui中测试它时。结果如下。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:GetUserListResponse xmlns:ns2="http://ws_query_hr/">
<return/>
<return/>
<return/>
</ns2:GetUserListResponse>
</soap:Body>
</soap:Envelope>
我如何获得响应的真正价值?我确定结果确实包含一些值。谢谢。 我更新了代码以返回一个 ArrayList 列表,这次有错误
Caused by: javax.xml.bind.MarshalException
- with linked exception:
[com.sun.istack.SAXException2: class java.util.ArrayList unkown
javax.xml.bind.JAXBException: class java.util.ArrayList unkNown。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)