juddi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mat Anthony Richard (JIRA)" <juddi-...@ws.apache.org>
Subject [jira] Created: (JUDDI-415) rg.apache.juddi.v3.error.UserMismatchException: An account must have administrative privileges to save publishers
Date Mon, 20 Sep 2010 12:17:33 GMT
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

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
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;
     String clazz = UDDIClientContainer.getUDDIClerkManager(null).
     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.

                security = transport.getUDDISecurityService(); //so we can get authorization
                juddiApi = transport.getJUDDIApiService();     //so we can save a publisher
                publish = transport.getUDDIPublishService();   //so publish entities to the

                //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

                System.out.println("**Using user:"+getAuthTokenRoot.getUserID());
                // Making API call that retrieves the authentication token for the 'root'
                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.setPublisherName("My Publisher");

                // Adding the publisher to the "save" structure, using the 'root' user authentication
info and
                // saving away.
                SavePublisher sp = new SavePublisher();

                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
                GetAuthToken getAuthTokenMyPub = new GetAuthToken();
                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");

                // Adding the business entity to the "save" structure, using our publisher's
authentication info
                // and saving away.
//Save Business
                SaveBusiness sb = new SaveBusiness();
                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");

               // Adding the service to the "save" structure, using our publisher's authentication
info and
               // saving away.
               SaveService ss = new SaveService();
               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)

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

View raw message