Java consumindo WS SharePoint

0 respostas
V

Boa tarde Pessoal,

Estou tentando consumir um WS do SharePoint 2010 usando o Axis2, porém não estou conseguindo autenticar (o SharePoint usa NTLM), ai tentei via HttpClient da Apache e funcionou, só que ai não consigo deixar a autenticação viva, por isso tirei a estrutura com HttpClient e estou tentando da seguinte maneira

System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");  
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");  
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire.header", "debug");  

NTCredentials creds = new NTCredentials("username", "password", "", "domain");  
  
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();  
auth.setUsername(creds.getUserName());  
auth.setPassword(creds.getPassword());  
auth.setDomain(creds.getDomain());  
auth.setHost(host);
auth.setPort(80);

HttpTransportProperties.ProxyProperties proxyProperties =  new HttpTransportProperties.ProxyProperties();
proxyProperties.setProxyName ("xxx.xxx.x.xx");
proxyProperties.setProxyPort (80);

	   
List authPrefs = new ArrayList(1);  
authPrefs.add(AuthPolicy.NTLM);  
auth.setAuthSchemes(authPrefs);  

ListsSoapStub listsStub = new ListsSoapStub(new URL("http://portal.interno.com/News/_vti_bin/lists.asmx"), null);

listsStub._setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);  

listsStub._setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION, org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);
listsStub._setProperty(org.apache.axis2.transport.http.HTTPConstants.PROXY, proxyProperties);
  
GetListItemsResponseGetListItemsResult result = listsStub.getListItems("954d237d-5900-4872-bb3b-bdd7202eb299", "ff01f7dc-77b8-41ae-aaa0-b9gh4a01a48f", null, null, "10", null, "");

Mesmo procurando muito não consegui resolver, e sempre da esse erro

Criado 21 de dezembro de 2011
Respostas 0
Participantes 1