Results 1 to 5 of 5
- 03-06-2009, 10:00 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
Connecting to a url with Domain, username and password
I am trying to access a URL(ASPX page on IIS) from Java (Weblogic). I am getting the following url.
java.io.FileNotFoundException: Response: '401: Unauthorized' for url
Any suggestions on how to make a call with domain name?
Here is my 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()));
TIA.
- 03-09-2009, 03:54 PM #2
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
any help, ?
- 03-10-2009, 07:19 AM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Well the line that is probably throwing the exception
...you failed to tell us what 'serviceURL' is, so it's hard to help.Java Code:URL url = new URL(serviceURL);
- 03-10-2009, 04:19 PM #4
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
No, It is failing here:
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
serviceURL is the internal URL that is hosted on IIS, which has the security.
- 03-11-2009, 12:11 AM #5
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
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 am trying to access a webpage that has Windows integrated security enabled.
Similar Threads
-
WSIT username password token failed
By fiqueudrue in forum NetBeansReplies: 1Last Post: 02-06-2009, 08:08 AM -
password username and databases
By chalo in forum JCreatorReplies: 0Last Post: 12-02-2008, 08:11 AM -
username password verification
By bheezee in forum JDBCReplies: 0Last Post: 11-25-2008, 06:55 PM -
Help, created a username and password box
By cachi in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 04:21 AM -
JTextFields with username & password.
By Eric in forum AWT / SwingReplies: 2Last Post: 07-01-2007, 11:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks