zoukankan      html  css  js  c++  java
  • soap请求(axis2异步解析wsdl文件)

    import java.text.SimpleDateFormat;
    import java.util.Date;
    
    import javax.xml.namespace.QName;
    
    import org.apache.axis2.AxisFault;
    import org.apache.axis2.addressing.EndpointReference;
    import org.apache.axis2.client.Options;
    import org.apache.axis2.rpc.client.RPCServiceClient;
    
    import util.ServiceAuthReq;
    import util.ServiceAuthRsp;
    
    
    public class Test {
    
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		SimpleDateFormat sd = new SimpleDateFormat("yyyyMMddHHmmss");
    		String s=sd.format(new Date());
    		
    		
    		ServiceAuthReq a_req=new ServiceAuthReq();
    		a_req.setUserID(s);
    		
    		try {
    			RPCServiceClient client = new RPCServiceClient();
    	        Options options = client.getOptions();   
    	        //设置调用WebService的URL   
    	        String address = "http://localhost:8080/testWebService/SPSysInterfacePort?wsdl";
    	        EndpointReference epf = new EndpointReference(address);   
    	        options.setTo(epf);  
    	        
    	        QName qname = new QName("http://ws.apache.org/axis2", "serviceAuth");  
    	        Object[] result = client.invokeBlocking(qname, new Object[] { a_req }, new Class[] { ServiceAuthRsp.class }); 
    	        ServiceAuthRsp ss=(ServiceAuthRsp) result[0];
    	        System.out.println("result is " + ss.getResult());  
    		} catch (AxisFault e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}  
    	}
    
    }
    

      这里要引入jar包-------------------------》网盘:axis2目录下

  • 相关阅读:
    GeoServer发布PostGIS数据库中的栅格数据
    CMD查看端口占用情况
    css选择器命名推荐
    css书写顺序
    css中浮动相关
    动态规划算法
    KMP算法 字符串匹配
    Java 反射
    分治(Divide-and-Conquer(P))算法
    图 结构
  • 原文地址:https://www.cnblogs.com/tongxinyuan/p/4567039.html
Copyright © 2011-2022 走看看