日期:2014-05-19  浏览次数:20774 次

有关axis调用webservice无参数传入但是有返回参数的方法
是这样的,网上大部分的文章都是调用webservice中有参数传入的方法,可是我调用的方法没有参数,就只是返回一个字符串,这个怎么调用,我汗,我试了半天都不行,老是报错。调用getWorkFlowMessagesList这个方法,可是这个方法定义是这样的:public String getWorkFlowMessagesList(),这个又该怎么调用呢??me是初学者,实在是困惑啊。网上的答案五花八门的,我都晕了
调用有参数的是这样的:
 String endpoint = "http://10.0.13.81:7003/pur/services/MssMonitorServer?wsdl";
  //直接引用远程的wsdl文件
  //以下都是套路 
  Service service = new Service();
  Call call = (Call) service.createCall();
  call.setTargetEndpointAddress(endpoint);
  call.setOperationName("getWorkFlowMessagesList");
  //call.addParameter("time", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
  //call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型  
  //String temp1 = "2010-09-01 12:00:00";
  int temp2 = 2;
  String result = (String)call.invoke(new Object[]{null});
把代码中注释的去掉就可以了。谢谢啊

------解决方案--------------------
返回的错误是什么呢?