Is there a way to currently get a BASIC auth secured .wsdl with JBossWS?
| WSDLDefinitionsFactory
|
| private Document getDocument(URL wsdlLocation) throws WSDLException
| {
| try
| {
| InputStream wsdlInputStream = wsdlLocation.openStream();
| try
| {
| DocumentBuilder builder = DOMUtils.getDocumentBuilder();
| return builder.parse(wsdlInputStream);
| }
| finally
| {
| wsdlInputStream.close();
| }
| }
| catch (ConnectException ex)
| {
| throw new WSDLException("Cannot connect to: " + wsdlLocation);
| }
| catch (Exception ex)
| {
| throw new WSDLException("Cannot parse wsdlLocation: " +
wsdlLocation, ex);
| }
| }
|
This is probably the code that fetches .wsdl?
How to push username / password in?
Should be using something like this then:
| if(!wsdlurl.getProtocol().startsWith("http"))
| return new InputSource(uri);
| java.net.URLConnection connection = wsdlurl.openConnection();
| if(!(connection instanceof HttpURLConnection))
| return new InputSource(uri);
| HttpURLConnection uconn = (HttpURLConnection)connection;
| String userinfo = wsdlurl.getUserInfo();
| uconn.setRequestMethod("GET");
| uconn.setAllowUserInteraction(false);
| uconn.setDefaultUseCaches(false);
| uconn.setDoInput(true);
| uconn.setDoOutput(false);
| uconn.setInstanceFollowRedirects(true);
| uconn.setUseCaches(false);
| String auth = null;
| if(userinfo != null)
| auth = userinfo;
| else
| if(username != null)
| auth = password != null ? username + ":" + password : username;
| if(auth != null)
| uconn.setRequestProperty("Authorization", "Basic " +
base64encode(auth.getBytes("ISO-8859-1")));
| uconn.connect();
| return new InputSource(uconn.getInputStream());
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984851#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...