public static void main(String[] args) {
  try {
      System.out.println(getResult());
     } catch (MalformedURLException e) {
      e.printStackTrace();
     } catch (RemoteException e) {
      e.printStackTrace();
     } catch (ServiceException e) {
      e.printStackTrace();
     } catch (SOAPException e) {
      e.printStackTrace();
     }
 }
 
 public static String getResult() throws ServiceException, MalformedURLException, RemoteException, SOAPException{
  String ret="";
  String login = "administrator";
        String password = "admin!@#";
        String year = "2004";
        String State = "DC";
     try {
   String endpoint = "http://192.168.1.111:8180/dswsbobje/qaawsservices/biws?WSDL=1&cuid=AcZ.DtvBDHpNq8Czi54Uzms"; // 创建一个服务(service)调用(call) Service service = new Service(); Call call = (Call)service.createCall();// 通过service创建call对象 // 设置service所在URL call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName("mytest","runQueryAsAService"));
   //Add 是net 那边的方法 "http://tempuri.org/" 这个也要注意Namespace 的地址,不带也会报错
   call.addParameter(new QName("mytest","login"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(new QName("mytest","password"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(new QName("mytest","year"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter(new QName("mytest","State"),org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.setUseSOAPAction(true); call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); //返回参数的类型 call.setSOAPActionURI("mytest/runQueryAsAService"); //这个也要注意 就是要加上要调用的方法Add,不然也会报错 // Object 数组封装了参数,参数为"This is Test!",调用processService(String arg) ret = (String)call.invoke(new Object[]{login,password,year,State}); System.out.println("--------"+ret.length()); }catch (Exception e){ System.err.println(e.toString()); } return ret; }