File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes Calling IIS web page from java (that is deployed in Weblogic) using Windows security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Calling IIS web page from java (that is deployed in Weblogic) using Windows security" Watch "Calling IIS web page from java (that is deployed in Weblogic) using Windows security" New topic
Author

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

get started
Greenhorn

Joined: Mar 10, 2009
Posts: 4
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,
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
I don't think URLConnection supports Windows Security. If that's the same as NTLM, then check out HttpClient - it supports that.


Ping & DNS - updated with new look and Ping home screen widget
get started
Greenhorn

Joined: Mar 10, 2009
Posts: 4
where do I specify domain name? this is only accepting username and password?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18136
    
    8

Try "domain\user" for your user name.
get started
Greenhorn

Joined: Mar 10, 2009
Posts: 4
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..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling IIS web page from java (that is deployed in Weblogic) using Windows security
 
Similar Threads
output in a file
Applet to servlet communication does not work in weblogic 9.2.4
servlet calling xhtml file
Runtime.getRuntime() help plzzzzzzzz
How to access a page with Windows Integrated security?