How to access password protected WSDL using JAXWS without using a default authenticator?

wsdl The conclusion below is password protected, but paranoia makes me uncomfortable by setting a default authenticator for the application. How to set authentication without using a default authenticator?

protected Orders getOrdersPort(String wsdlLocation, String namespaceURI) { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("username", "password".toCharArray()); } }); OrdersService service = new OrdersService(createUrlThrowRuntimeException(wsdlLocation), new QName(namespaceURI, "OrdersService")); Orders ordersPort = service.getOrdersSoap12(); setConnectionTimeout(ordersPort); return ordersPort; } 
+4
source share
1 answer

One of the workarounds is, of course, loading wsdl into a local file and using this file. It would be nice to not do this though.

+1
source

All Articles