This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Request Username and Password before any function of webService is called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Request Username and Password before any function of webService is called" Watch "Request Username and Password before any function of webService is called" New topic
Author

Request Username and Password before any function of webService is called

Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
Hello.

For three days i have been surfing and searching over the internet but cant find any use full tutorial.
The main problem is:

I have a soap web service. The main thing of the web service will be that you will have to register a user to it to get the exact data.
For example:
We have user1 that has access to doc1, doc3 and doc 7. So user will give the userName and password to the client and the client will send the login data to the webservice. The web service would check if the login data is ok ( this web service will be handling permissions ) and send the confirmation status. So now the client request the documents and the service returns him only the documents he has access to.

The main problem is i don't know exactly what to search for. We have a soap web service in php and to use it over the soapUI you had to add you userName and password. I dont know how to request this data in a java web service.


In the link i give you an example how my webapp looks like.
App1
It is an application ready to be built and an already built app

I'm using WebSphere for my web applications.
To build an web application I use Maven.
All my applications are in Java and i am currently using JDK6_11

If any other information is needed just say it and i will give it.
For any help would be grate full.
Thank you very much.
Lp, Mesni
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
If you are using standard JavaEE security, then you could retrieve the principal (available both in EJB and servlet endpoints) and then retrieve the name from the principal.
Using this name, you can then determine which document to return to the client.
Best wishes!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
This kind of thing is the realm of the WS-Security standard, which specifies username/password authentication, amongst other things. All major Java SOAP frameworks (like Axis 2, Metro and JBossWS) support it. Consult the documentation of whichever one you're using for details on how to use it.


Ping & DNS - my free Android networking tools app
Ales Mesni
Greenhorn

Joined: Dec 16, 2009
Posts: 14
I've been watching trough all these things but the problem is i want to find a good example that works but didn't find anything. Maybe the problem is that i am searching wrong. Thank you for all the replies
 
jQuery in Action, 2nd edition
 
subject: Request Username and Password before any function of webService is called
 
Similar Threads
SCDJWS Beta!!!!!!
Difference between Webservice and XML over HTTP??
web service using json in java
java soap client to connect to sugarCRM server
unexpected XML tag in JAX-WS client