• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

how to send user credentials to a protected restful webservice  RSS feed

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ranchers,

i am trying to get the data from a restful webservice which is running using a java client program. I am able to connect to it and get the data, but the limitation in my code is that it can't connect to the restful endpoint which needs authentication. I h've tried search for this over online but couldn't get a proper clue. Can any one help me out.

The intention is to pass the username and password to the rest url where the authentication is required.

the two types of approaches i h've made is
 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this help http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html
Ask the restful web service provider for the type/kind of authentication needed.
 
Ranch Hand
Posts: 36
Eclipse IDE Java ME Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Saipraneeth,

You can use this tiny program I created here: http://ta.cnci.org/more-about-java/29-java-servers-and-services/232-remoteservice-a-simple-client-to-test-your-restful-and-soap-services
if you are accessing a BASIC authentication type. Different authentication will required different headers setting.

Good luck,
T.A.
 
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the authentication type is OATH 1, this site will walk you through the needed header construction steps :

http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/

This article explains how to use some of the Java routines within an ESB :

http://www.soabus.org/viewtopic.php?f=3&t=13
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!