Skip to Content
Jan 16, 2019 at 11:06 AM

Login in UME using UME API

176 Views Last edit Jan 16, 2019 at 11:22 AM 5 rev

I'm trying to connect to a SAP AS JAVA System and Manipulate the UME. I have a EJB WebService (HelloWorldEJB) in the Java System, I'm trying to hit HelloWorldEJB from an External application's (AppService) Restful service.

So the flow is like: UI5 Application (AppWeb) --> AppService --> HelloWorldEJB

I'm able to hit the HelloWorldEJB, but when I check the logged in user it's show as "J2EE_GUEST". This is because user authorization is not done in HelloWorldEJB. How I can login with a user in HelloWorldEJB using UME API?

AppService code to call the HelloWorldEJB:

public class RestService {
    public String sayHello() {
      String result = "";
      try { url =  new"");
        javax.xml.namespace.QName qName =  new javax.xml.namespace.QName("", "HelloBeanService");
        HelloBeanService client = new HelloBeanService(url, qName);
        HelloBean helloService = client.getHelloBeanPort();
        result = helloService.sayHello();
      } catch (Exception e) {
         result = e.toString();
      return result;

HelloWorldEJB code to check logged in user:

@WebService(endpointInterface = "", portName = "HelloBeanPort", serviceName = "HelloBeanService", targetNamespace = "")
public class HelloBean implements HelloBeanRemote, HelloBeanLocal {
    public String sayHello() {
        IUser user = UMFactory.getAuthenticator().getLoggedInUser();
        return "Hello" + user.getDisplayName(); //retuned "J2EE_GUEST"
        //need to login user here.

I got to know I should use

ILogonAuthentication logonAuthentication =UMFactory.getLogonAuthenticator();
logonAuthentication.logon(request, response,"default")

But I'm not using Servlet Client to access the service, so how I can set the value for request and response.


Amir Suhail