81,116
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) throws AxisFault {
ServiceClient sc = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(
"http://localhost:8080/webtools/control/SOAPService"));
opts.setAction("getShopScoreTest");
sc.setOptions(opts);
OMElement res = sc.sendReceive(createPayLoad());
System.out.println(res);
System.out.println(getResults(res));
}
public static List<String> getResults(OMElement element) {
if (element == null) {
return null;
}
Iterator iterator = element.getChildElements();
Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result = null;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
innerItr = result.getChildElements();
// System.out.println(innerItr);
System.out.println(((OMElement)innerItr.next()).getLocalName());
}
return list;
}

public static List<String> getResults(OMElement element) {
if (element == null) {
return null;
}
System.out.println("IN: " + element); // 新增
Iterator iterator = element.getChildElements();
Iterator innerItr;
List<String> list = new ArrayList<String>();
OMElement result = null;
while (iterator.hasNext()) {
result = (OMElement) iterator.next();
System.out.println("While: " + result); // 新增
innerItr = result.getChildElements();
while (innerItr.hasNext()) { // 新增
OMElement elem = (OMElement)innerItr.next(); // 新增
System.out.println("\tWhile: "+elem); // 新增
System.out.println("\t\t" + elem.getLocalName() + ": " + elem.getText()); // 新增
} // 新增
}
return list;
}