2

I am making a REST webservice call to a protected webservice from a java application. The application is also protected so that I need to login to the application for accessing it. Actually when I invoke the webservice call, I am getting the LDAP login URL as the response as below instead of expected result from the webservice. "https://login-stage.oracle.com:443/oam/server/obrareq.cgi?" Looks the webservice is expecting the user session to be passed. Is there anyway we can pass the user session in the REST webservice client call? Here is my code below.

ClientConfig config = new DefaultClientConfig();
Client client = Client.create(config);
WebResource service = client.resource(REST_URI);

restResponse = getResponse(service);        

Please suggest an approach for it.

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
user1611498
  • 97
  • 1
  • 9

2 Answers2

1

Since you are calling a REST Service there shouldn't be a session based authentication.

Maybe have a look here. RESTful Authentication

Community
  • 1
  • 1
questionaire
  • 2,475
  • 2
  • 14
  • 28
0

If I understand your question correctly, this is not possible or not RESTful. A RESTful webservice does not keep any session at all, in fact this is one of the strength of this design pattern.

What you can do is, to add user credentials to the requests. The link provided by questionare is a very good starting point and offers some more options.

sschrass
  • 7,014
  • 6
  • 43
  • 62
  • Actually I can not retrieve the password entered by the login user. – user1611498 Apr 06 '15 at 11:54
  • You provide some sort of service interacting with a remote service. So the user has to enter his credentials at some point for the remote service. – sschrass Apr 06 '15 at 11:58