use of javax.wsdl.Types in project cxf by apache.
the class WSDLSchemaManager method addWSDLSchemaImport.
public void addWSDLSchemaImport(Definition def, String tns, File file) throws Exception {
// REVISIT, check if the wsdl schema already exists.
Types types = def.getTypes();
if (types == null) {
types = def.createTypes();
def.setTypes(types);
}
Schema wsdlSchema = (Schema) def.getExtensionRegistry().createExtension(Types.class, new QName(Constants.URI_2001_SCHEMA_XSD, "schema"));
addWSDLSchemaImport(wsdlSchema, tns, file);
types.addExtensibilityElement(wsdlSchema);
}
use of javax.wsdl.Types in project cxf by apache.
the class WSDLASTVisitor method getLogicalDefinition.
// Gets the logical definition for a file - an import will be added for the
// schema types if -T is used and a separate schema file generated.
// if -n is used an import will be added for the schema types and no types generated.
private Definition getLogicalDefinition(String schemaFilename, Writer schemaWriter) throws WSDLException, JAXBException, Exception {
Definition def = manager.createWSDLDefinition(targetNamespace);
// checks for -T option.
if (schemaFilename != null) {
writeSchemaDefinition(definition, schemaWriter);
manager.addWSDLSchemaImport(def, schema.getTargetNamespace(), schemaFilename);
} else {
// checks for -n option
if (importSchemaFilename == null) {
Types types = definition.getTypes();
def.setTypes(types);
} else {
manager.addWSDLSchemaImport(def, schema.getTargetNamespace(), importSchemaFilename);
}
}
Collection<PortType> portTypes = CastUtils.cast(definition.getAllPortTypes().values());
for (PortType port : portTypes) {
def.addPortType(port);
}
Collection<Message> messages = CastUtils.cast(definition.getMessages().values());
for (Message msg : messages) {
def.addMessage(msg);
}
Collection<String> namespaces = CastUtils.cast(definition.getNamespaces().values());
for (String namespace : namespaces) {
String prefix = definition.getPrefix(namespace);
if (!"corba".equals(prefix)) {
def.addNamespace(prefix, namespace);
} else {
def.removeNamespace(prefix);
}
}
Collection<Import> imports = CastUtils.cast(definition.getImports().values());
for (Import importType : imports) {
def.addImport(importType);
}
def.setDocumentationElement(definition.getDocumentationElement());
def.setDocumentBaseURI(definition.getDocumentBaseURI());
return def;
}
Aggregations