webservice返回List如何解析
我用AXIS2做了一个服务,用AXIS2客户API调用它
public class Main {
public OMElement createPayLoad(){
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://service.test.com", "ns1");
OMElement method = fac.createOMElement("getWxpBaseList",omNs);
OMElement value = fac.createOMElement("hpzl", omNs);
value.setText("01");
OMElement value2 = fac.createOMElement("hphm", omNs);
value2.setText("皖A21763");
method.addChild(value);
method.addChild(value2);
return method;
}
public static void main(String[] args) throws Exception{
ServiceClient serviceClient = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference("http://localhost:8080/WxpService/services/WxpTransService"));
opts.setAction("urn:getWxpBaseList");
serviceClient.setOptions(opts);
OMElement res = serviceClient.sendReceive(new Main().createPayLoad());//blocking method
System.out.println(res);
}
}
输出的结果如下:
<ns:getWxpBaseListResponse xmlns:ns="http://service.keli.com">
<ns:return xmlns:ax22="http://objwxp.db.keli.com/xsd" xmlns:ax21="http://res.keli.com/xsd" type="com.keli.res.WxpBaseResult">
<ax21:objList type="com.keli.db.objwxp.WxpBaseInfor" >
<ax22:hphm>皖A21763</ax22:hphm>
<ax22:hpzl>01</ax22:hpzl>
<ax22:hpzl_V>大型汽车</ax22:hpzl_V>
</ax21:objList>
<ax21:obj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
</ns:return>
</ns:getWxpBaseListResponse>
请问返回是个List,我该如何解析它,并把它封装成type所指定的类型