list of the projects available for the logged in user

Description
yashgolwara
Posts: 8
Joined: Mon Mar 12, 2018 4:53 am

list of the projects available for the logged in user

Postby yashgolwara » Mon Mar 12, 2018 5:24 am

After logging in the polarion , i am trying to get the list of the projects available for the logged in user

i am able to login and get the number of users

Code: Select all

      WebServiceFactory factory;
      TrackerWebService trackerService;
      SessionWebService sessionService;
      ProjectWebService projectService;
      
      factory = new WebServiceFactory("http://localhost/polarion/ws/services/");
      

      sessionService = factory.getSessionService();
      sessionService.logIn("userId", "password");
   

now after logging in , i am trying to get the list of users::

Code: Select all

   User[] users = projectService.getUsers();
      String uri = null;
      for (int i = 0; i < users.length; i++) {
         User user = users[i];
         if (user.getId().equals("admin")) {
            System.out.println("id.."+user.getId());
            System.out.println("name..."+user.getName());
            System.out.println("uri...."+user.getUri());// Value: uri....subterra:data-service:objects:/default/${User}admin
            //System.out.println(user.getDescription());

            uri = user.getUri();

         }
      }
      

After getting the user URI , when i am trying to get the project list :

Code: Select all


Project[] projs=projectService.getContainedProjects(uri);

       System.out.println(projs.length);
      
i am getting excpetion : Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: com.polarion.alm.ws.WrongURIException: Expected a URI pointing to a object of interface com.polarion.alm.projects.model.IProjectGroup. Object found for subterra:data-service:objects:/default/${User}admin is a class com.polarion.alm.projects.internal.model.User.
 faultActor:
 faultNode:
 faultDetail:
   {http://xml.apache.org/axis/}stackTrace:com.polarion.alm.ws.WrongURIException: Expected a URI pointing to a object of interface com.polarion.alm.projects.model.IProjectGroup. Object found for subterra:data-service:objects:/default/${User}admin is a class com.polarion.alm.projects.internal.model.User.
   
   

now the issue is i am not getting , how to get the URI for IProjectGroup, as the URI i am getting for the USER interface is not working.


It would be really helpful if someone can provide me some insights on how to proceed further

smarty
Posts: 50
Joined: Fri Jan 18, 2013 4:43 pm
Location: Germany / Frankfurt
Contact:

Re: list of the projects available for the logged in user

Postby smarty » Tue Mar 13, 2018 5:23 pm

Hello yashgolwara,
I have not tried to create a webservice for Polarion yet, but maybe the free extension Navigation Panel
gives you an idea of the right approach.
One of its features:
The rendered Tree Structure can be Global or Restricted to a Program Group and filtered by closing a Project Group, hiding a specific, or all inactive, Projects and filtering rendered Projects by "User Roles".


Regards, Martin
My environment: Polarion ALM 2016 SR2 on Windows Server 2012,
Polarion-JIRA Connector to JIRA 7.x


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 2 guests