0 Replies Latest reply: Nov 18, 2012 11:32 PM by eagle_eye RSS

    Password change on OBIEE - using a webservice....

      Hi All,
      With a lot of help from expets on the web, I have put together a webservice routine which allows a user to change their password from within a dashboard. I have used Oracle JDeveloper 11g Release 2, Java(TM) Platform     1.6.0_24. The source code is as below.

      package obieeweb;
      import java.lang.management.ManagementFactory;
      import java.net.InetAddress;
      import java.util.HashMap;
      import java.util.Set;

      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebService;
      import javax.management.MBeanServer;
      import javax.management.ObjectName;
      import javax.management.remote.JMXConnectorServer;
      import javax.management.remote.JMXConnectorServerFactory;
      import javax.management.remote.JMXServiceURL;

      @WebService(name = "STLOBIEEWebServices", serviceName = "STLOBIEEWebServicesService", portName = "STLOBIEEWebServicesPort")
      public class OBIEEWebServices {

      public String OBIEEWebService(@WebParam(name = "arg0")
      String userId, @WebParam(name = "arg1")
      String oldPassword, @WebParam(name = "arg2")
      String newPassword, @WebParam(name = "arg3")
      String confirmPassword) throws Exception
      MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
      HashMap env = new HashMap();

      final String hostname = InetAddress.getLocalHost().getHostName();
      final int port = 10000;
      JMXServiceURL serviceUrl = new JMXServiceURL("service:jmx:rmi://"+hostname+":"+port+"/jndi/rmi://"+hostname+":"+port+"/jmxrmi");
      JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serviceUrl,env, mbs);

      ObjectName securityMBeanName = new ObjectName("Security:Name=myrealmDefaultAuthenticator");
      Object[] params = new Object[] { userId, oldPassword, newPassword};
      String[] signature = new String[] {"java.lang.String", "java.lang.String", "java.lang.String"};
      if (newPassword.equals(confirmPassword)) {
      mbs.invoke(securityMBeanName, "changeUserPassword", params,signature);
      catch(Exception e)
      return e+"|Error changing Password.";
      return "Password changed successfully.";
      return "Passwords don't match. Try again.";

      @WebMethod(exclude = true)
      public static void main() throws Exception {
      String confirmPassword, newPassword, oldPassword, userId;
      confirmPassword = " ";
      newPassword = " ";
      oldPassword = " ";
      userId = " ";
      OBIEEWebServices ow = new OBIEEWebServices();
      ow.OBIEEWebService( userId, oldPassword, newPassword, confirmPassword);

      I get the following error

      weblogic.management.NoAccessRuntimeException: [Management:141102]Subject: principals=[] does not have access to perform Admin actions.|Error changing Password.

      After serarching through the forums, it appears that this piece of code should run as an admin user instead of anynymous. Various suggestions either did not work or did not compile. Any suggestions would be most appreciated. I must admit I am a newbie and have not had a lot of exposure in this area.


      Edited by: user607704 on Nov 18, 2012 9:31 PM