• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calling IIS web page from java (that is deployed in Weblogic) using Windows security

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having trouble calling a IIS webpage, which enables Windows security. The code works fine in stand alone Java application, but not after deploying to weblogic.

Here is the sample code:

String auth = domain + "\\" + userName ":" + password;
String encodedAuth = new BASE64Encoder().encode(auth.getBytes());
URL url = new URL(serviceURL);
URLConnection yc = url.openConnection();
yc.setRequestProperty ("Authorization", "Basic " + encodedAuth);
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));

How do we specify windows authentication? Is it the correct way? Thanks,
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think URLConnection supports Windows Security. If that's the same as NTLM, then check out HttpClient - it supports that.
 
get started
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where do I specify domain name? this is only accepting username and password?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try "domain\user" for your user name.
 
get started
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpMethodBase method = null;
try {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new NTCredentials(userName, pwd, host, domain) );
System.out.println(httpServiceURL);

method = new GetMethod(httpServiceURL);
method.setDoAuthentication( true );
int status = client.executeMethod(method);
System.out.println(status + "\n" + method.getResponseBodyAsString());
}

This works fine on stand alone java application, but when I deploy it to Weblogic.. it just hangs at GetMethod. No exception, nothing..
 
reply
    Bookmark Topic Watch Topic
  • New Topic