This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!