Skip to Content
avatar image
Former Member

Java Web Service retrieving Portal User Information


I have to write a Web Service that receive as parameter a "userID" and returns the information (firstname, lastname,...) from this Portal user.

I'm a bit lost, don't know where to start from.

- Should i write a java class and then wrap it in a web service?

- Should i use the librairies ?

- Is there something already existing that i could use a reference?

- What's the best way to build this Web Service?

Thanks for all your input,



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 14, 2009 at 08:46 AM

    Hi Thomas,

    1- Yes this is the way for web service. You can create two Java Classes for web service. One for web service, one for helper class to get user information,

    2- You have to use Security Libraries.

    3- You can find example code for getting user information below.

    4- /people/baris.buyuktanir2/blog/2007/07/30/how-to-create-a-visual-composer-user-selection-screen-with-ume-web-service-part-i

    Example code to get user information:

    	public static String getUserNameSurname(String uid)
    		String ret = "";
    		IUser user = null;
    			user = getUser(uid);
    			ret = user.getFirstName() + " " + user.getLastName();
    		catch(Exception ex)
    		return ret;
    	public static IUser getUser(String uid) throws Exception{
    			throw new IllegalArgumentException("uid can't be null");
    		IUserFactory userFactory = UMFactory.getUserFactory();
    		return userFactory.getUserByLogonID(uid);

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 19, 2009 at 07:58 AM

    I am currently developing a PHP application that will connect to Portal KM repository for document management and such. Since my PHP application resides on a separate server and I was having a very difficult time in authenticating a user and returning their assigned roles and Portal User info via MYSAPSSO2 session cookie I figured out a way to retrieve the logon name from the logon portal form and pass that valuue to a java based web service that returns all portal user information associated with that user.

    The development was fairly simple. I first created an EJB Project type that had 1 session bean in it. This bean had 1 business method that had 1 input parameter (which is the currently logged in user name), that would then response/return type of a String array of the Portal users information. The code listed above is what you should start with for the actual implementation of the EJB business method you create.

    You will have to include the jar file to the EJB project properties "add external jar". This will give you access to the various methods for retrieving Portal user info.

    Once I had the bean created with the business method, I simply right clicked on the bean and selected create web service. After completing the web service creation wizard for that bean, all the interfaces for exposing the web service were generated automatically.

    Once that was completed I built the ejb project and added the project to a new Enterprise Application project and built that which generated an EAR file. Right click on the EAR file and click on deploy to J2EE engine. Once the EAR is deployed you will see the new web service in the Portal WS Navigator.

    Edited by: GS on Dec 18, 2009 11:59 PM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Do you have SSO enabled from the desktop to the Portal? If not you will have to authenticate the user somehow so they will at a minimum logon to the portal so the mysapsso2 session cookie is set.

      You could set the SOAP authentication to none when generating the web service. That way you will be able to call the WS and not have to authenticate to the portal to retrieve the respons back from the web service.

      How do you plan on knowing who the user you are requesting info for is if they do not log on to the portal?