Web Service 调用和返回值问题

lhg_jz88 2008-04-18 02:41:01
这个问题好像有很多人,我的问题是开始我在Server端用的返回值是List,有些人说不好,我就用了Object[],但是我在客户端时用的是ADB生成的Stub方法生成的客户端,也就是response返回之后是个OMElement的类型,这个类型怎么解析出来,请大家指点,最好给个小代码例子。我的WSDL是好用的 可以返回出一个LISt的值,但客户端出不来。

万分感谢。
...全文
66 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sir_eagle 2008-04-18
  • 打赏
  • 举报
回复
public class TestRain {
private static EndpointReference targetEPR = new EndpointReference(
"http://localhost:8080/axis2/services/dd");

public static OMElement getQueryOMElement() {
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://xut.edu.cn/",
"test");
OMElement method = fac.createOMElement("query", omNs);
method.setText("41100900");
return method;
}

public static void main(String[] args) {
try {
// Make the request message
Options options = new Options();
options.setTo(targetEPR);
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
options.setAction("query");
// test query method
OMElement query = TestRain.getQueryOMElement();
OMElement result = sender.sendReceive(query);
System.out.println(result);
} catch (Exception axisFault) {
axisFault.printStackTrace();
}
}
}
//-----------------------------------------
供参考
本例使用的是AXIS2.1.3版本
临远 2008-04-18
  • 打赏
  • 举报
回复
axis14里反正是没法返回List这种collection对象,只能用Object[]的方式。

例子见我们教程:
http://www.family168.com/tutorial/axis14/html/axis14-ch-03.html
薛定谔之死猫 2008-04-18
  • 打赏
  • 举报
回复
没试过这东东

WebLogic上的客户端可以把用到的类都生成出来,包括参数和返回值

印象中是这样

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧