• Post Reply Bookmark Topic Watch Topic
  • New Topic

authentication error invoking restful web service using basic authentication and https

 
Neil Gold
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to invoke a Restful webservice using basic authentication over SSL. I know the uid/pwd are correct. Not sure why the server is giving me an authentication error. See the full error after the code



HttpResponseProxy{HTTP/1.1 401 Unauthorized [Date: Mon, 18 Apr 2016 19:23:24 GMT, Server: Apache-Coyote/1.1, WWW-Authenticate: Basic realm="Authentication required", Content-Type: text/html;charset=utf-8, Content-Language: en, Content-Length: 994, Connection: close] ResponseEntityProxy{[Content-Type: text/html;charset=utf-8,Content-Length: 994,Chunked: false]}

Apache Tomcat/8.0.32 - Error reportH1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}

HTTP Status 401 -
type Status report

message

description This request requires HTTP authentication.

Apache Tomcat/8.0.32
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You code looks like it should work. It would be helpful to look at the HTTP headers to see if the Authorization header is present.

If you can test with HTTP (no SSL) then you can use something like Wireshark to capture the network traffic. If you need to stick with HTTPS, then maybe you could use something like Fiddler2 to peek in to the encrypted traffic.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!