Newsgroup: it.comp.java
Titolo: client Axis2, problemi con il proxy

Scusate sto cercando di fare un client Axis2 per accedere ad un WS
esterno e per accederci devo passare da un proxy.
Però ottengo i seguenti errori:
GRAVE: Credentials cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredentials
org.apache.commons.httpclient.auth.InvalidCredentialsException:
Credentials cannot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswordCredentials
INFO: Unable to sendViaPost to url[https://*****]
org.apache.axis2.AxisFault: Transport error: 407 Error: Proxy
Authentication Required ( The ISA Server requires authorization to
fulfill the request. Access to the Web Proxy filter is denied.  )
Qualcuno puo' dirmi cosa devo cambiare?
Le ho provate tutte!
Qui di seguito il codice:
class ProxyAuthenticator extends Authenticator {
	private String user, password;
	public ProxyAuthenticator(String user, String password) {
		this.user = user;
		this.password = password;
	}
	protected PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(user, password.toCharArray());
	}
}
public class AppMain {
	private static String address = "https://*****";
	private static String proxyHost = "*****";
	private static String proxyPort = "*****";
	private static String proxyUser = "*****";
	private static String proxyPassword = "*****";
	public static void main(String[] args) throws Exception {
		/*-*/
		Authenticator.setDefault(new ProxyAuthenticator(proxyUser,
proxyPassword));
		Properties props = System.getProperties();
		props.put("http.proxyHost", proxyHost);
		props.put("http.proxyPort", proxyPort);
		props.put("http.proxyUser", proxyUser);
		props.put("http.proxyPassword", proxyPassword);
		props.put("https.proxyHost", proxyHost);
		props.put("https.proxyPort", proxyPort);
		props.put("https.proxyUser", proxyUser);
		props.put("https.proxyPassword", proxyPassword);
		/*-*/
		HttpTransportProperties.Authenticator authentication = new
HttpTransportProperties.Authenticator();
		authentication.setUsername(proxyUser);
		authentication.setPassword(proxyPassword);
		authentication.setHost(proxyHost);
		authentication.setPort(Integer.parseInt(proxyPort));
		/*-*/
		HttpTransportProperties.ProxyProperties proxyProperties = new
HttpTransportProperties.ProxyProperties();
		proxyProperties.setProxyName(proxyHost);
		proxyProperties.setProxyPort(Integer.parseInt(proxyPort));
		proxyProperties.setUserName(proxyUser);
		proxyProperties.setPassWord(proxyPassword);
		Options options1 = new Options();
		options1 = new ReportingServiceStub(address)._getServiceClient
().getOptions();
		options1.setProperty(HTTPConstants.PROXY, proxyProperties);
		options1.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION,
HTTPConstants.HEADER_PROTOCOL_10);
		options1.setProperty(HTTPConstants.AUTHENTICATE, authentication);
		options1.setProperty(AuthPolicy.AUTH_SCHEME_PRIORITY,
AuthPolicy.NTLM);
		/*-*/
		ServiceClient client = new ServiceClient();
		client = new ReportingServiceStub(address)._getServiceClient();
		client.setOptions(options1);
		Options options2 = new Options();
		options2.setTo(new EndpointReference(address));
		options2.setAction("urn:getReportingData");
		client.setOptions(options2);
		OMElement res = client.sendReceive(createPayLoad());
		System.out.println(res.toString());
	}
	public static OMElement createPayLoad() {
		OMFactory fac = OMAbstractFactory.getOMFactory();
		OMNamespace omNs = fac.createOMNamespace("
http://ws.apache.org/
axis2", "ns1");
		OMElement method = fac.createOMElement("getReportingData", omNs);
		OMElement value1 = fac.createOMElement("******", omNs);
		value1.setText("******");
		method.addChild(value1);
		OMElement value2 = fac.createOMElement("******", omNs);
		value2.setText("******");
		method.addChild(value2);
		OMElement value3 = fac.createOMElement("******", omNs);
		value3.setText("******");
		method.addChild(value3);
		return method;
	}
}
Grazie.

 fulfill the request. Access to the Web Proxy filter is denied.  )
ISA Server ? ahi ahi ahi
Con Axis 1 mi ci son rotto la testa finch� ....
... mi hanno caricato l'ISA client sul pc che ospitava java.
Ho ancora il faldone di materiale raccattato per capirci qualcosa di
NTLM, java ed autorizzazioni.
Se non possono installare /installarti l'ISA client (e allora la
faccenda si fa grigia) prova a fare qualche ricerca con JCIFS : e' un
pacchetto per l'accesso alle autenticazioni di rete windows.
In bocca al lupo, perch� � un pacchetto tosto.
Ciao,
    Davide
--
Ing. Davide Grandi
davide...@mclink.it