Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

authentication error invoking restful web service using basic authentication and https

 
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
 
Marshal
Posts: 3150
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • 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.
 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic