axis2调用webservice接口,客户端添加用户和密码认证

    public class Test {  
      
        public static void main(String[] args) {  
      
            try {  
                TESTStub service = new TESTStub();  
                //认证代码 start  
                HttpTransportProperties.Authenticator auth = new         

                HttpTransportProperties.Authenticator();

                auth.setUsername("****");  
                auth.setPassword("*****");  
      
                service._getServiceClient().getOptions().setProperty(HTTPConstants.AUTHENTICATE, auth);  
                //认证代码 end  
                TESTparam params = new TESTparam();  
                TESTparamResponse response = service.tTESTparam(params);  
            } catch (Exception e) {  
                e.printStackTrace();  
            }  
      
        }  
      
    } 

猜你喜欢

转载自huanggua12353719.iteye.com/blog/2286183