| Author |
Opened a socket with ssl. isConnected returns true. But when sending data get 403
|
John Landon
Ranch Hand
Joined: Sep 25, 2008
Posts: 211
|
|
Hi,
I did this with the following VM params:
-Djavax.net.ssl.trustStore=mySrvKeystore -Djavax.net.ssl.trustStorePassword=123456
isConnected is true but when sending data via the channel I get:
HTTP/1.1 403 Forbidden
Content-Type: text/html
Server: Microsoft-IIS/7.5
What I did is in IIS I created a certificate then exported it and imported to my keystore....
Any idea? Because via the browser I can access the server.
Thanks!
|
 |
Rob Spoor
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18370
|
|
Well, to get an error 403 you must be connected first, so that part is correct.
Error 403 means that you must provide some form of authentication, and you haven't provided the right authentication. Since you say it works just fine in your browser I'm guessing that the website uses NTLM authentication; in other words, your Windows username / password are used. You need to provide them manually. With URLConnection / HttpURLConnection / HttpsURLConnection, java.net.Authenticator would be the way to go. With HttpClient there is class NTCredentials. With direct socket connections, I have no idea how to send the authentication details.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
John Landon
Ranch Hand
Joined: Sep 25, 2008
Posts: 211
|
|
Rob Spoor wrote:Well, to get an error 403 you must be connected first, so that part is correct.
Error 403 means that you must provide some form of authentication, and you haven't provided the right authentication. Since you say it works just fine in your browser I'm guessing that the website uses NTLM authentication; in other words, your Windows username / password are used. You need to provide them manually. With URLConnection / HttpURLConnection / HttpsURLConnection, java.net.Authenticator would be the way to go. With HttpClient there is class NTCredentials. With direct socket connections, I have no idea how to send the authentication details.
I can't use that.
This is what I am using now:
I get CONNECT$ED SOCKET. But still 403 or it just gets stuck!
|
 |
Rob Spoor
Saloon Keeper
Joined: Oct 27, 2005
Posts: 18370
|
|
|
As I said before, you will need to send the credentials you need to login with. As you cannot use a higher level of abstraction like HttpClient or even URLConnection, you will need to figure out how to send these credentials manually.
|
 |
 |
|
|
subject: Opened a socket with ssl. isConnected returns true. But when sending data get 403
|
|
|