通過Axis webservice客戶端進行NTLM認證的方法:
axis是通過httpclient進行認證的,所以需要先下載httpclient程序,還需要解碼程序commons-codec-1.3.jar

這兩個接口google一下就行了,Axis的客戶端代碼如下:
 1         try
 2         {
 3             String endpoint = "http://localhost:7001/Test/WebServices.asmx?wsdl";
 4             Service service = new Service();
 5             Call    call    = (Call)service.createCall();
 6             
 7             call.setTargetEndpointAddress(new URL(endpoint));
 8             call.getMessageContext().setUsername("domain\\user");
 9             call.getMessageContext().setPassword("password");
10             call.setClientHandlers(new CommonsHTTPSender(),null);
11             
12             call.setOperationName(new QName("Method"));
13             call.addParameter("ParamName1", XMLType.XSD_STRING, ParameterMode.IN );
14             call.setReturnClass(String.class);
15             String ret  = (String)call.invoke(new Object[]{new String("aaaa")});
16             
17             System.out.println(ret);            
18             
19         }
20         catch(Exception ex)
21         {
22             ex.printStackTrace();
23         }

通過監聽客戶端發出的http頭信息,可以發現發出的認證信息如下:
   Authorization: NTLM LKJSDLKFJLSDKJFLKSDAAAAAAAAAAAAAAAAAAAAAAA=

服務器如果采用一般的http認證,可以HTTPSender代替CommonHttpSender,通過他的代碼可以發現:
 1         if (userID != null) {
 2             StringBuffer tmpBuf = new StringBuffer();
 3 
 4             tmpBuf.append(userID).append(":").append((passwd == null)
 5                     ? ""
 6                     : passwd);
 7             otherHeaders.append(HTTPConstants.HEADER_AUTHORIZATION)
 8                     .append(": Basic ")
 9                     .append(Base64.encode(tmpBuf.toString().getBytes()))
10                     .append("\r\n");
11         }

HttpSender直接生成http的Authorization頭信息進行設置,發出的http header代碼例子:
Authorization: Basic SDKFJLSDKJLlsdlfksjdflksjw232lj

如果需要進行webservice的自定義認證可以自己實現axis的handler。