This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
ScroogeXHTML 8.0 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/704747/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!