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

call.addParameter("arg1", qn, ParameterMode.IN)是什么意思,要先引用什么包吗?
以下程序参考自网上,但是原文没有定义好引用的包; 
现在运行时出现一个错误: 
can not find symbol;symbol:variable ParameterMode; 
请问出错行是什么意思,该怎么用,谢谢! 

package test.backup; 
import org.apache.axis.client.Call; 
import org.apache.axis.client.Service; 
import javax.xml.namespace.QName; 
public class CheckClient { 
  public CheckClient() { 
  } 
  public static void main(String [] args) throws Exception 
  { 
  String targetEendPoint = 
  "http://localhost:8080/axis/services/CheckOrder"; 

  OrderBean order = new OrderBean(); 
  order.setName("Beckham"); 
  order.setAge(32); 
  String[] items = new String[] {"Ipod", "ThinkPad"}; 
  int[] price = new int[] {999, 5000}; 
  order.setItems(items); 
  order.setPrice(price); 
  order.setChecked(false); 

  System.out.println(order.isChecked()); 

  Service service = new Service(); 
  Call call = (Call) service.createCall(); 
  QName qn = new QName("urn:AnalyzeOrder", "Order"); 
  call.registerTypeMapping(OrderBean.class, qn, 
  new org.apache.axis.encoding.ser. 
  BeanSerializerFactory(OrderBean.class, qn), 
  new org.apache.axis.encoding.ser. 
  BeanDeserializerFactory(OrderBean.class, qn)); 

  call.setTargetEndpointAddress(new java.net.URL(targetEendPoint)); 
  call.setOperationName(new QName("CheckOrder", "process")); 
  call.addParameter("arg1", qn, ParameterMode.IN); 
  call.setReturnClass(OrderBean.class); 

  OrderBean result = (OrderBean) call.invoke(new Object[] {order}); 

  System.out.println("Success..."); 
  System.out.println(result.isChecked()); 

  } 
}

------解决方案--------------------
没引入
javax.xml.rpc.ParameterMode

The javax.xml.rpc.ParameterMode is a type-safe enumeration for parameter mode. This class is used in the CallAPI to specify parameter passing modes.