zoukankan      html  css  js  c++  java
  • axis调用webservice的简单方法

    package com.service;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    
    public class test2 {
     public static void main(String args[]){ 	
             String helloURL = "http://localhost:8889//services/HrmService";
             try {
                 //以下都是套路 
                 Service service = new Service();
                 Call call = (Call)service.createCall();
                 call.setTargetEndpointAddress(helloURL);
                 call.setOperationName("checkUser");//WSDL里面描述的接口名称
                 call.addParameter("in0", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                 call.addParameter("in1", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                 call.addParameter("in2", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//接口的参数
                 
                 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_BOOLEAN);//设置返回类型  
                
                 //给方法传递参数,并且调用方法
                 Object result = call.invoke(new String[]{"127.0.0.1","ywy","1"});
                 System.out.println((Boolean)result);
                 
              } catch (Exception e) {
                  e.printStackTrace();
              }
              
    	 } 
    }
    
    •  注意:url不能带wsdl,否则会报错
  • 相关阅读:
    元组类型
    字符串类型
    列表类型
    python 循环
    python语句
    python运算符
    python1
    软件管理
    rpm yum
    LVM
  • 原文地址:https://www.cnblogs.com/JsonShare/p/4213286.html
Copyright © 2011-2022 走看看