CentraSite 10.5 | CentraSite Developer's Guide | Importing Objects Using API | Invoking Importer from Java Program | Importing Schema
 
Importing Schema
The schema importer works closely with the web service importer. Since a WSDL file of a web service may import or include schema files, CentraSite enables you to design and store a schema before referencing the WSDL files. Similarly, if a schema file is imported by more than one WSDL file, it could be beneficial to register the schema first, before registering the WSDL files. When a schema is imported, the file is copied into the CentraSite repository and an ExternalLink that controls the resource is created. If a schema imports (includes) further schemas, then the referenced schemas are also imported. The referenced relations are established by means of a Uses association in the registry. This figure illustrates the relationship:
This example demonstrates how to import a schema file into CentraSite:
import com.centrasite.jaxr.JAXRAccessor;
import com.centrasite.jaxr.schema.SchemaImporter;
 
String dbURL = "http://localhost:53307/CentraSite/CentraSite";
String xsdFile = "c:/temp/MySchema.xsd";
String user = ...;
String password = ...;
 
JAXRAccessor jaxr = new JAXRAccessor(dbURL, user, password);
 
try
{
SchemaImporter si = new SchemaImporter(xsdFile, jaxr);
si.add();
}
catch (Exception e)
{
// handle error
}
finally
{
jaxr.close();
}