You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juddi.apache.org by "Kurt T Stam (JIRA)" <ju...@ws.apache.org> on 2010/10/04 15:54:34 UTC

[jira] Updated: (JUDDI-415) rg.apache.juddi.v3.error.UserMismatchException: An account must have administrative privileges to save publishers

     [ https://issues.apache.org/jira/browse/JUDDI-415?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kurt T Stam updated JUDDI-415:
------------------------------

    Attachment: SimplePublish2.java

This is the class I used to reproduce the issue, however the class works just fine.

> rg.apache.juddi.v3.error.UserMismatchException: An account must have administrative privileges to save publishers
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: JUDDI-415
>                 URL: https://issues.apache.org/jira/browse/JUDDI-415
>             Project: jUDDI
>          Issue Type: Bug
>          Components: juddi-tomcat
>    Affects Versions: 3.0.3
>         Environment: software used:-   1) apache-tomcat-6.0.24 2) MySQL 5.1  3) JUDDI 3.0.3  4) java version 1.6.0_05 
>            Reporter: Mat Anthony Richard
>            Assignee: Kurt T Stam
>             Fix For: 3.0.3
>
>         Attachments: SimplePublish2.java
>
>
> I have created the following client to save a Publisher into JUDDI register. Each time I run the code it throws an exception 
> at:- juddiApi.savePublisher(sp); 
> The error displayed:- 
> org.apache.juddi.v3.error.UserMismatchException: An account must have administrative privileges to save publishers 
> In the Juddi Admin, I have checked that the Publisher Id=root is an administrator and this is enabled. 
> I have als checked the PUBLISHER table within the juddi database within MySQL, I currently have
> root and marketing users  as administrators (i.e. IS_ADMIN set to true   and IS_ENABLED set to true)
> The code is as follows:- 
> package org.my.client;
> import org.apache.juddi.v3.client.config.UDDIClientContainer;
> import org.apache.juddi.v3.client.transport.Transport;
> import org.apache.juddi.ClassUtil;
> import org.uddi.v3_service.*;
> import org.apache.juddi.v3_service.*;
> import org.uddi.api_v3.GetAuthToken;
> import org.uddi.api_v3.AuthToken;
> import org.apache.juddi.api_v3.Publisher;
> import org.apache.juddi.api_v3.SavePublisher;
> import org.uddi.api_v3.BusinessEntity;
> import org.uddi.api_v3.Name;
> import org.uddi.api_v3.SaveBusiness;
> import org.uddi.api_v3.BusinessDetail;
> import org.uddi.api_v3.BusinessService;
> import org.uddi.api_v3.SaveService;
> import org.uddi.api_v3.ServiceDetail;
> public class SimplePublish
> {
>   
>   public static void main(String[] args)
>   {
>     UDDISecurityPortType   security=null;
>     JUDDIApiPortType       juddiApi=null;
>     UDDIPublicationPortType publish=null;
>   try
>   {
>      String clazz = UDDIClientContainer.getUDDIClerkManager(null).
>                     getClientConfig().getUDDINode("default").getProxyTransport();
>      Class<?> transportClass = ClassUtil.forName(clazz, Transport.class);
>      if (transportClass!=null) {
>                 //Retrieve the default client transport class which is designed to make
>                 //UDDI calls out using JAX-WS web services
>                  System.out.println("Start-Setting up authentication token");
>                 Transport transport = (Transport) transportClass.
>                     getConstructor(String.class).newInstance("default");
>                 security = transport.getUDDISecurityService(); //so we can get authorization tokens
>                 juddiApi = transport.getJUDDIApiService();     //so we can save a publisher
>                 publish = transport.getUDDIPublishService();   //so publish entities to the registry
>                 //Setup authentication code
>                 //=========================
>                 // Setting up the values to get an authentication
>                 // token for the 'root' user ('root' user
>                 //  has admin privileges and can save other publishers).
>                 GetAuthToken getAuthTokenRoot = new GetAuthToken();
>                 getAuthTokenRoot.setUserID("root"); //root
>                 getAuthTokenRoot.setCred("");
>                 System.out.println("**Using user:"+getAuthTokenRoot.getUserID());
>                 // Making API call that retrieves the authentication token for the 'root' user.
>                 AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
>                 System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
>                 System.out.println("End-Setting up authentication token");
>                 //Note 'root' user (or publisher) acts as administrator for jUDDI API calls
> //Now add a Publisher (i.e. using root publisher)
> //=======================================================================
>                 // Creating a new publisher that we will use to publish our entities to.
>                 System.out.println("Start-Setting up publisher");
>                 Publisher p = new Publisher();
>                 p.setAuthorizedName("my-publisher");
>                 p.setPublisherName("My Publisher");
>                 p.setIsAdmin("true");
>                 // Adding the publisher to the "save" structure, using the 'root' user authentication info and
>                 // saving away.
>                 SavePublisher sp = new SavePublisher();
>                 sp.getPublisher().add(p);
>                 sp.setAuthInfo(rootAuthToken.getAuthInfo());
>                 juddiApi.savePublisher(sp);
>                 System.out.println("End-Setting up publisher");
>                 //Since have setup a publisher within the register, we now need to obtain it's authentication token
>                 //Note that we have no credentials, since we are using the default authenticator
>                 // Our publisher is now saved, so now we want to retrieve its authentication token
>                 GetAuthToken getAuthTokenMyPub = new GetAuthToken();
>                 getAuthTokenMyPub.setUserID("my-publisher");
>                 getAuthTokenMyPub.setCred("");
>                 AuthToken myPubAuthToken = security.getAuthToken(getAuthTokenMyPub);
>                 System.out.println ("myPub AUTHTOKEN = " + myPubAuthToken.getAuthInfo());
> //Now add a Business Entity (i.e. associated for My Publisher)
> //=======================================================================
> //Note a BusinessEntity contains the business description and contact information [ Note large companies have serveral of these per/dept ]
> //=============================================================================================================================
>                 // Creating the parent business entity that will contain our service.
>                 System.out.println("Start-Setting up Business entity");
>                 BusinessEntity myBusEntity = new BusinessEntity();
>                 Name myBusName = new Name();
>                 myBusName.setValue("My Business");
>                 myBusEntity.getName().add(myBusName);
>                 // Adding the business entity to the "save" structure, using our publisher's authentication info
>                 // and saving away.
> //Save Business
>                 SaveBusiness sb = new SaveBusiness();
>                 sb.getBusinessEntity().add(myBusEntity);
>                 sb.setAuthInfo(myPubAuthToken.getAuthInfo()); //Note ***used publisher token authoInfo here****
>                 BusinessDetail bd = publish.saveBusiness(sb);
>                 String myBusKey = bd.getBusinessEntity().get(0).getBusinessKey();
>                 System.out.println("myBusiness key:  " + myBusKey);
>                 System.out.println("End-Setting up Business entity");
> //Now add a Business Service to the Business Entity   (i.e.  My Business)
> //=======================================================================
> //Note a Business Service describes units of functionality that are consumed by the clients
> //=======================================================================
>                 // Creating a service to save.  Only adding the minimum data: the parent business key retrieved
>                 //from saving the business above and a single name.
>  //Save Service
>                 System.out.println("Start-Setting up Service");
>                 BusinessService myService = new BusinessService();
>                 myService.setBusinessKey(myBusKey);  //Note *****used the business key here******
>                 Name myServName = new Name();
>                 myServName.setValue("My Service");
>                 myService.getName().add(myServName);
>                 
>                // Adding the service to the "save" structure, using our publisher's authentication info and
>                // saving away.
>                SaveService ss = new SaveService();
>                ss.getBusinessService().add(myService);
>                ss.setAuthInfo(myPubAuthToken.getAuthInfo());  //Note ***used publisher token authoInfo here****
>                ServiceDetail sd = publish.saveService(ss);
>                String myServKey = sd.getBusinessService().get(0).getServiceKey();
>                System.out.println("myService key:  " + myServKey);
>                System.out.println("End-Setting up Service");
>      }
>   }
>   catch (Exception e)
>   {
>        e.printStackTrace();
>   }
>   }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.