• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to publish to IBM test UDDI registry server

 
Mike Chang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello there!
Got some problem using JAXR API to save an organization to IBM test UDDI
registry. The code is copied from Richard's book, J2EE Web Service.
And I have created an account and connection is ok using JAXR API.
The error message is as follows. Please help.

[java] **** BulkResponse Exceptions ****
[java] javax.xml.registry.SaveException: JAXR.UDDI.126: UDDI DispositionRep
ort: Error Code = E_fatalError; Error Message = E_fatalError (10500) Serious tec
hnical error has occurred while processing the request. cvc-type.3.1.1: [attribu
tes] of element 'name' must be empty, excepting those whose [namespace name] is
identical to http://www.w3.org/2001/XMLSchema-instance and whose [local name] is
one of type, nil, schemaLocation or noNamespaceSchemaLocation.; Error Number =
10500
[java] at com.sun.xml.registry.uddi.UDDIMapper.results2BulkResponse(Unk
nown Source)
[java] at com.sun.xml.registry.uddi.ResponseTransformer.transformRespon
se(Unknown Source)
[java] at com.sun.xml.registry.uddi.ResponseTransformer.transformRespon
se(Unknown Source)
[java] at com.sun.xml.registry.uddi.Processor.invokeMethod(Unknown Sour
ce)
[java] at com.sun.xml.registry.uddi.Processor.processResponseJAXB(Unkno
wn Source)
[java] at com.sun.xml.registry.uddi.Processor.processRequestJAXB(Unknow
n Source)
[java] at com.sun.xml.registry.uddi.UDDIMapper.saveOrganizations(Unknow
n Source)
[java] at com.sun.xml.registry.uddi.BusinessLifeCycleManagerImpl.saveOr
ganizations(Unknown Source)
[java] at Example1.main(Unknown Source)
[java] **************************************
The code listing:
import javax.xml.registry.ConnectionFactory;
import javax.xml.registry.Connection;
import javax.xml.registry.RegistryService;
import javax.xml.registry.BusinessLifeCycleManager;
import javax.xml.registry.infomodel.Organization;
import javax.xml.registry.infomodel.InternationalString;
import javax.xml.registry.JAXRException;
import javax.xml.registry.JAXRResponse;
import javax.xml.registry.BulkResponse;
import java.net.PasswordAuthentication;
import java.util.Properties;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
public class Example1 {

public static void main(String[] args) throws JAXRException {

String userName = "myusername";
String password = "mypassword";


Connection connection = connectToRegistry(userName, password);

RegistryService registry = connection.getRegistryService();
BusinessLifeCycleManager lifeCycleMngr = registry.getBusinessLifeCycleManager();

String companyName = new String("MyCompany");

Organization myOrganization = lifeCycleMngr.createOrganization(companyName);
//myOrganization.setName(lifeCycleMngr.createInternationalString("Hello"));

Set organizationSet = new HashSet();
organizationSet.add(myOrganization);

BulkResponse response = lifeCycleMngr.saveOrganizations(organizationSet);

doExceptions(response);

connection.close();

}
public static void doExceptions(BulkResponse response) throws JAXRException {

if(response.getStatus() == JAXRResponse.STATUS_SUCCESS) {
System.out.println("\nProgram Complete: No problems reported!");
}
else {
Iterator exceptions = response.getExceptions().iterator();
while(exceptions.hasNext()) {
Exception je = (Exception)exceptions.next();
System.out.println("\n**** BulkResponse Exceptions ****\n\n");
je.printStackTrace();
System.out.println("\n**************************************");
}
}
}

public static Connection connectToRegistry(String userName, String password) throws JAXRException {

ConnectionFactory factory = ConnectionFactory.newInstance();

Properties props = new Properties();
props.setProperty("javax.xml.registry.lifeCycleManagerURL",
"https://uddi.ibm.com/testregistry/publishapi");
props.setProperty("javax.xml.registry.queryManagerURL",
"http://uddi.ibm.com/testregistry/inquiryapi");
props.setProperty("javax.xml.registry.security.authenticationMethod","UDDI_GET_AUTHTOKEN");
factory.setProperties(props);

Connection connection = factory.createConnection();

PasswordAuthentication credential = new PasswordAuthentication(userName, password.toCharArray());
Set credentials = new HashSet();
credentials.add(credential);
connection.setCredentials(credentials);

return connection;
}
}
[ April 27, 2004: Message edited by: Mike Chang ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic