I have two Java web services deployed on Glassfish server, both inside the same web application. What is the easiest way to send an authorisation token (10 digit number) from one web service to another?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That depends entirely on what you mean by send.
I assume that you just mean that you want to allow web service #2 to have access to the token generated by web service #1?
There are a few options here, but a couple that jump to mind are:
webServiceContext.getMessageContext().get(MessageContext.SERVLET_CONTEXT);These assume that you can key into the token somehow (via a user id or something).
Additionally, this doesn’t cover the duration for which the auth’ token is considered valid and whether it should be valid when the app’ is stopped/started/redeployed. Above also doesn’t consider load balancing or anything funky like that; it’s assuming that you’re running a single Glassfish instance.