private void generateComplexTypeforException() { XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(schemaTargetNameSpace, "Exception", schema_namespace_prefix); XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false); complexType.setName("Exception"); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(elementName, complexType); typeTable.addComplexSchema(Exception.class.getName(), elementName); QName schemaTypeName = new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string"); addContentToMethodSchemaType(sequence, schemaTypeName, "Message", false); complexType.setParticle(sequence); }
private void generateComplexTypeforException() { XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(schemaTargetNameSpace, "Exception", schema_namespace_prefix); XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false); complexType.setName("Exception"); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(elementName, complexType); typeTable.addComplexSchema(Exception.class.getName(), elementName); QName schemaTypeName = new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string"); addContentToMethodSchemaType(sequence, schemaTypeName, "Message", false); complexType.setParticle(sequence); }
private void buildXmlTypeInfos() { for (final XmlSchema schema : xmlSchemaCollection.getXmlSchemas()) { // Global Elements for (final Iterator iterator = schema.getElements().getValues(); iterator.hasNext(); ) { final XmlSchemaElement globalElement = (XmlSchemaElement) iterator.next(); addGlobalElement(globalElement); } // Global Types for (final Iterator iterator = schema.getSchemaTypes().getValues(); iterator.hasNext(); ) { final XmlSchemaType globalType = (XmlSchemaType) iterator.next(); addType(globalType.getQName(), globalType); } } }
private void buildTypeDefinitions(XmlSchema schemaDef, String schemaTns, URI typeSystemURI) { XmlSchemaObjectTable typeTable = schemaDef.getSchemaTypes(); NamespacePrefixList prefixes = schemaDef.getNamespaceContext(); Iterator qnames = typeTable.getNames();
public void engage(CodeGenConfiguration configuration) throws CodeGenerationException { //WSDLDescription wom = this.configuration.getWom(); List schemaList = configuration.getSchemaListForAllServices(); if (schemaList == null || schemaList.isEmpty()) { //there are no types to be considered return; } for (int i = 0; i < schemaList.size(); i++) { XmlSchema s = (XmlSchema)schemaList.get(i); if (!s.getExternals().isEmpty()) { //there are some included - now see whether there are any //elements or types declared! if (s.getElements().isEmpty()&& s.getSchemaTypes().isEmpty() && s.getGroups().isEmpty() && s.getTargetNamespace() == null) { // if there's no targetNamespace there's probably no name, but try it anyway throw new CodeGenerationException( CodegenMessages.getMessage("extension.invalidWSDL", s.toString())); } } } } }
private void addCorbaTypes(XmlSchema xmlSchemaTypes) throws Exception { Map<QName, XmlSchemaType> objs = xmlSchemaTypes.getSchemaTypes(); CorbaType corbaTypeImpl = null; for (XmlSchemaType type : objs.values()) { boolean anonymous = WSDLTypes.isAnonymous(type.getName()); corbaTypeImpl = helper.convertSchemaToCorbaType(type, type.getQName(), null, null, anonymous); if (corbaTypeImpl != null && !helper.isDuplicate(corbaTypeImpl)) { typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl); } } addCorbaElements(corbaTypeImpl, xmlSchemaTypes); }
/** * Creates XML schema complex type with the given namespace and the name. * @param cparams The common parameters used in the schema generator * @param namespace The namespace of the complex type * @param name The name of the complex type * @param global Signal if the newly created type is global or not * @return The newly create XML schema complex type */ private static XmlSchemaComplexType createComplexType(CommonParams cparams, String namespace, String name, boolean global) { XmlSchema schema = retrieveSchema(cparams, namespace); XmlSchemaComplexType type = new XmlSchemaComplexType(schema); Map<QName, XmlSchemaComplexType> typeMap = cparams.getTypeMap(); if (global) { QName qname = new QName(namespace, name); if (typeMap.containsKey(qname)) { int suffix = 1; // start with 2, if T is there, the next one would be T2 while (typeMap.containsKey(new QName(namespace, name + (++suffix)))); name = name + suffix; qname = new QName(namespace, name); } type.setName(name); cparams.getTypeMap().put(qname, type); schema.getItems().add(type); schema.getSchemaTypes().add(qname, type); } return type; }
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaElement globalElement = new XmlSchemaElement(xmlSchema, false); globalElement.setName(localPartName); boolean disallowAnonTypes = isAnonymousTypesDisallowed(); if (disallowAnonTypes) { String complexTypeName = localPartName.substring(0, 1).toUpperCase() + localPartName.substring(1); complexType.setName(complexTypeName); globalElement.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(complexType.getQName(), complexType); } else { globalElement.setSchemaType(complexType); } xmlSchema.getItems().add(globalElement); xmlSchema.getElements().put(elementName, globalElement); } typeTable.addComplexSchema(localPartName, elementName); return complexType; }
private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaElement globalElement = new XmlSchemaElement(xmlSchema, false); globalElement.setName(localPartName); boolean disallowAnonTypes = isAnonymousTypesDisallowed(); if (disallowAnonTypes) { String complexTypeName = localPartName.substring(0, 1).toUpperCase() + localPartName.substring(1); complexType.setName(complexTypeName); globalElement.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(complexType.getQName(), complexType); } else { globalElement.setSchemaType(complexType); } xmlSchema.getItems().add(globalElement); xmlSchema.getElements().put(elementName, globalElement); } typeTable.addComplexSchema(localPartName, elementName); return complexType; }
for (Map.Entry<QName, XmlSchemaType> e : schemaInfo.getSchemaTypes().entrySet()) { QName name = e.getKey(); XmlSchemaType type = e.getValue();
private XmlSchemaComplexType createSchemaTypeForFault(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaElement globalElement = new XmlSchemaElement(xmlSchema, false); globalElement.setName(localPartName); boolean disallowAnonTypes = isAnonymousTypesDisallowed(); if (disallowAnonTypes) { complexType.setName(localPartName); globalElement.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(complexType.getQName(), complexType); } else { globalElement.setSchemaType(complexType); } xmlSchema.getItems().add(globalElement); xmlSchema.getElements().put(elementName, globalElement); } return complexType; }
private XmlSchemaComplexType createSchemaTypeForFault(String localPartName) { XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix); XmlSchemaComplexType complexType = getComplexTypeForElement(xmlSchema, elementName); if (complexType == null) { complexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaElement globalElement = new XmlSchemaElement(xmlSchema, false); globalElement.setName(localPartName); boolean disallowAnonTypes = isAnonymousTypesDisallowed(); if (disallowAnonTypes) { complexType.setName(localPartName); globalElement.setSchemaTypeName(complexType.getQName()); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(complexType.getQName(), complexType); } else { globalElement.setSchemaType(complexType); } xmlSchema.getItems().add(globalElement); xmlSchema.getElements().put(elementName, globalElement); } return complexType; }
xmlSchema.getSchemaTypes().put( new QName(schemaTargetNameSpace, xmlSchemaComplexType.getName()), xmlSchemaComplexType);
entryType.setName(entryName.getLocalPart()); xmlSchema.getItems().add(entryType); xmlSchema.getSchemaTypes().put(entryName, entryType); schemaType = entryType;
entryType.setName(entryName.getLocalPart()); xmlSchema.getItems().add(entryType); xmlSchema.getSchemaTypes().put(entryName, entryType); schemaType = entryType;