Search in sources :

Example 6 with Types

use of javax.wsdl.Types in project cxf by apache.

the class SchemaUtil method getSchemaList.

// Workaround for getting the elements
private void getSchemaList(Definition def) {
    Types typesElement = def.getTypes();
    if (typesElement != null) {
        Iterator<?> ite = typesElement.getExtensibilityElements().iterator();
        while (ite.hasNext()) {
            Object obj = ite.next();
            if (obj instanceof Schema) {
                Schema schema = (Schema) obj;
                addSchema(schema.getDocumentBaseURI(), schema);
            }
        }
    }
}
Also used : Types(javax.wsdl.Types) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Schema(javax.wsdl.extensions.schema.Schema)

Example 7 with Types

use of javax.wsdl.Types in project cxf by apache.

the class WSDLCorbaWriterImpl method fixTypes.

private void fixTypes(Definition wsdlDef) throws ParserConfigurationException {
    Types t = wsdlDef.getTypes();
    if (t == null) {
        return;
    }
    List<ExtensibilityElement> l = CastUtils.cast(t.getExtensibilityElements());
    if (l == null) {
        return;
    }
    for (ExtensibilityElement e : l) {
        if (e instanceof Schema) {
            Schema sc = (Schema) e;
            String pfx = wsdlDef.getPrefix(sc.getElementType().getNamespaceURI());
            if (StringUtils.isEmpty(pfx)) {
                pfx = "xsd";
                String ns = wsdlDef.getNamespace(pfx);
                int count = 1;
                while (!StringUtils.isEmpty(ns)) {
                    pfx = "xsd" + count++;
                    ns = wsdlDef.getNamespace(pfx);
                }
                wsdlDef.addNamespace(pfx, sc.getElementType().getNamespaceURI());
            }
            if (sc.getElement() == null) {
                fixSchema(sc, pfx);
            }
        }
    }
}
Also used : Types(javax.wsdl.Types) Schema(javax.wsdl.extensions.schema.Schema) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 8 with Types

use of javax.wsdl.Types in project cxf by apache.

the class XSDToWSDLProcessor method addWSDLTypes.

private void addWSDLTypes() throws ToolException {
    Element sourceElement = this.xsdDoc.getDocumentElement();
    Element targetElement = (Element) sourceElement.cloneNode(true);
    this.wsdlDefinition.setTargetNamespace((String) env.get(ToolConstants.CFG_NAMESPACE));
    this.wsdlDefinition.setQName(new QName(WSDLConstants.NS_WSDL11, (String) env.get(ToolConstants.CFG_NAME)));
    Types types = this.wsdlDefinition.createTypes();
    ExtensibilityElement extElement;
    try {
        registry = wsdlFactory.newPopulatedExtensionRegistry();
        registerJAXWSBinding(Definition.class);
        registerJAXWSBinding(Types.class);
        registerJAXWSBinding(Schema.class);
        extElement = registry.createExtension(Types.class, WSDLConstants.QNAME_SCHEMA);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SCHEMA_EXTENSION", LOG);
        throw new ToolException(msg, wse);
    }
    ((Schema) extElement).setElement(targetElement);
    types.addExtensibilityElement(extElement);
    this.wsdlDefinition.setTypes(types);
    WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
    Writer outputWriter = getOutputWriter();
    try {
        wsdlWriter.writeWSDL(wsdlDefinition, outputWriter);
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_WRITE_WSDL", LOG);
        throw new ToolException(msg, wse);
    }
    try {
        outputWriter.close();
    } catch (IOException ioe) {
        Message msg = new Message("FAIL_TO_CLOSE_WSDL_FILE", LOG);
        throw new ToolException(msg, ioe);
    }
}
Also used : Types(javax.wsdl.Types) Message(org.apache.cxf.common.i18n.Message) WSDLException(javax.wsdl.WSDLException) QName(javax.xml.namespace.QName) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Element(org.w3c.dom.Element) Schema(javax.wsdl.extensions.schema.Schema) ToolException(org.apache.cxf.tools.common.ToolException) WSDLWriter(javax.wsdl.xml.WSDLWriter) IOException(java.io.IOException) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) WSDLWriter(javax.wsdl.xml.WSDLWriter) Writer(java.io.Writer)

Example 9 with Types

use of javax.wsdl.Types in project ofbiz-framework by apache.

the class ModelService method getTypes.

public Types getTypes(Document document, Definition def) {
    Types types = def.createTypes();
    /* Schema */
    Element schema = document.createElement("xsd:schema");
    schema.setAttribute("targetNamespace", TNS);
    /*-----------------------------------*/
    /*--------- Standard Objects --------*/
    /*-----------------------------------*/
    /* null Element */
    Element stdNullElement = document.createElement("xsd:element");
    stdNullElement.setAttribute("name", "null");
    stdNullElement.setAttribute("nillable", "true");
    Element stdNullElement0 = document.createElement("xsd:complexType");
    stdNullElement.appendChild(stdNullElement0);
    Element stdNullElement1 = document.createElement("xsd:attribute");
    stdNullElement0.appendChild(stdNullElement1);
    stdNullElement1.setAttribute("name", "value");
    stdNullElement1.setAttribute("type", "xsd:string");
    stdNullElement1.setAttribute("use", "required");
    schema.appendChild(stdNullElement);
    /* std-String Element */
    Element stdStringElement = document.createElement("xsd:element");
    stdStringElement.setAttribute("name", "std-String");
    Element stdStringElement0 = document.createElement("xsd:complexType");
    stdStringElement.appendChild(stdStringElement0);
    Element stdStringElement1 = document.createElement("xsd:attribute");
    stdStringElement0.appendChild(stdStringElement1);
    stdStringElement1.setAttribute("name", "value");
    stdStringElement1.setAttribute("type", "xsd:string");
    stdStringElement1.setAttribute("use", "required");
    schema.appendChild(stdStringElement);
    /* std-Integer Element */
    Element stdIntegerElement = document.createElement("xsd:element");
    stdIntegerElement.setAttribute("name", "std-Integer");
    Element stdIntegerElement0 = document.createElement("xsd:complexType");
    stdIntegerElement.appendChild(stdIntegerElement0);
    Element stdIntegerElement1 = document.createElement("xsd:attribute");
    stdIntegerElement0.appendChild(stdIntegerElement1);
    stdIntegerElement1.setAttribute("name", "value");
    stdIntegerElement1.setAttribute("type", "xsd:integer");
    stdIntegerElement1.setAttribute("use", "required");
    schema.appendChild(stdIntegerElement);
    /* std-Long Element */
    Element stdLongElement = document.createElement("xsd:element");
    stdLongElement.setAttribute("name", "std-Long");
    Element stdLongElement0 = document.createElement("xsd:complexType");
    stdLongElement.appendChild(stdLongElement0);
    Element stdLongElement1 = document.createElement("xsd:attribute");
    stdLongElement0.appendChild(stdLongElement1);
    stdLongElement1.setAttribute("name", "value");
    stdLongElement1.setAttribute("type", "xsd:long");
    stdLongElement1.setAttribute("use", "required");
    schema.appendChild(stdLongElement);
    /* std-Float Element */
    Element stdFloatElement = document.createElement("xsd:element");
    stdFloatElement.setAttribute("name", "std-Float");
    Element stdFloatElement0 = document.createElement("xsd:complexType");
    stdFloatElement.appendChild(stdFloatElement0);
    Element stdFloatElement1 = document.createElement("xsd:attribute");
    stdFloatElement0.appendChild(stdFloatElement1);
    stdFloatElement1.setAttribute("name", "value");
    stdFloatElement1.setAttribute("type", "xsd:float");
    stdFloatElement1.setAttribute("use", "required");
    schema.appendChild(stdFloatElement);
    /* std-Double Element */
    Element stdDoubleElement = document.createElement("xsd:element");
    stdDoubleElement.setAttribute("name", "std-Double");
    Element stdDoubleElement0 = document.createElement("xsd:complexType");
    stdDoubleElement.appendChild(stdDoubleElement0);
    Element stdDoubleElement1 = document.createElement("xsd:attribute");
    stdDoubleElement0.appendChild(stdDoubleElement1);
    stdDoubleElement1.setAttribute("name", "value");
    stdDoubleElement1.setAttribute("type", "xsd:double");
    stdDoubleElement1.setAttribute("use", "required");
    schema.appendChild(stdDoubleElement);
    /* std-Boolean Element */
    Element stdBooleanElement = document.createElement("xsd:element");
    stdBooleanElement.setAttribute("name", "std-Boolean");
    Element stdBooleanElement0 = document.createElement("xsd:complexType");
    stdBooleanElement.appendChild(stdBooleanElement0);
    Element stdBooleanElement1 = document.createElement("xsd:attribute");
    stdBooleanElement0.appendChild(stdBooleanElement1);
    stdBooleanElement1.setAttribute("name", "value");
    stdBooleanElement1.setAttribute("type", "xsd:boolean");
    stdBooleanElement1.setAttribute("use", "required");
    schema.appendChild(stdBooleanElement);
    /* std-Locale Element */
    Element stdLocaleElement = document.createElement("xsd:element");
    stdLocaleElement.setAttribute("name", "std-Locale");
    Element stdLocaleElement0 = document.createElement("xsd:complexType");
    stdLocaleElement.appendChild(stdLocaleElement0);
    Element stdLocaleElement1 = document.createElement("xsd:attribute");
    stdLocaleElement0.appendChild(stdLocaleElement1);
    stdLocaleElement1.setAttribute("name", "value");
    stdLocaleElement1.setAttribute("type", "xsd:string");
    stdLocaleElement1.setAttribute("use", "required");
    schema.appendChild(stdLocaleElement);
    /* std-BigDecimal Element */
    Element stdBigDecimalElement = document.createElement("xsd:element");
    stdBigDecimalElement.setAttribute("name", "std-BigDecimal");
    Element stdBigDecimalElement0 = document.createElement("xsd:complexType");
    stdBigDecimalElement.appendChild(stdBigDecimalElement0);
    Element stdBigDecimalElement1 = document.createElement("xsd:attribute");
    stdBigDecimalElement0.appendChild(stdBigDecimalElement1);
    stdBigDecimalElement1.setAttribute("name", "value");
    stdBigDecimalElement1.setAttribute("type", "xsd:decimal");
    stdBigDecimalElement1.setAttribute("use", "required");
    schema.appendChild(stdBigDecimalElement);
    /*-----------------------------------*/
    /*----------- SQL Objects -----------*/
    /*-----------------------------------*/
    /* sql-Timestamp Element */
    Element sqlTimestampElement = document.createElement("xsd:element");
    sqlTimestampElement.setAttribute("name", "sql-Timestamp");
    Element sqlTimestampElement0 = document.createElement("xsd:complexType");
    sqlTimestampElement.appendChild(sqlTimestampElement0);
    Element sqlTimestampElement1 = document.createElement("xsd:attribute");
    sqlTimestampElement0.appendChild(sqlTimestampElement1);
    sqlTimestampElement1.setAttribute("name", "value");
    sqlTimestampElement1.setAttribute("type", "xsd:dateTime");
    sqlTimestampElement1.setAttribute("use", "required");
    schema.appendChild(sqlTimestampElement);
    /* sql-Date Element */
    Element sqlDateElement = document.createElement("xsd:element");
    sqlDateElement.setAttribute("name", "sql-Date");
    Element sqlDateElement0 = document.createElement("xsd:complexType");
    sqlDateElement.appendChild(sqlDateElement0);
    Element sqlDateElement1 = document.createElement("xsd:attribute");
    sqlDateElement0.appendChild(sqlDateElement1);
    sqlDateElement1.setAttribute("name", "value");
    sqlDateElement1.setAttribute("type", "xsd:date");
    sqlDateElement1.setAttribute("use", "required");
    schema.appendChild(sqlDateElement);
    /* sql-Time Element */
    Element sqlTimeElement = document.createElement("xsd:element");
    sqlTimeElement.setAttribute("name", "sql-Time");
    Element sqlTimeElement0 = document.createElement("xsd:complexType");
    sqlTimeElement.appendChild(sqlTimeElement0);
    Element sqlTimeElement1 = document.createElement("xsd:attribute");
    sqlTimeElement0.appendChild(sqlTimeElement1);
    sqlTimeElement1.setAttribute("name", "value");
    sqlTimeElement1.setAttribute("type", "xsd:time");
    sqlTimeElement1.setAttribute("use", "required");
    schema.appendChild(sqlTimeElement);
    /*-----------------------------------*/
    /*----------- List Objects -----------*/
    /*-----------------------------------*/
    /* col-ArrayList Element */
    Element colArrayListElement = document.createElement("xsd:element");
    colArrayListElement.setAttribute("name", "col-ArrayList");
    colArrayListElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colArrayListElement);
    /* col-LinkedList Element */
    Element colLinkedListElement = document.createElement("xsd:element");
    colLinkedListElement.setAttribute("name", "col-LinkedList");
    colLinkedListElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colLinkedListElement);
    /* col-Stack Element */
    Element colStackElement = document.createElement("xsd:element");
    colStackElement.setAttribute("name", "col-Stack");
    colStackElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colStackElement);
    /* col-Vector Element */
    Element colVectorElement = document.createElement("xsd:element");
    colVectorElement.setAttribute("name", "col-Vector");
    colVectorElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colVectorElement);
    /* col-TreeSet Element */
    Element colTreeSetElement = document.createElement("xsd:element");
    colTreeSetElement.setAttribute("name", "col-TreeSet");
    colTreeSetElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colTreeSetElement);
    /* col-HashSet Element */
    Element colHashSetElement = document.createElement("xsd:element");
    colHashSetElement.setAttribute("name", "col-HashSet");
    colHashSetElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colHashSetElement);
    /* col-Collection Element */
    Element colCollectionElement = document.createElement("xsd:element");
    colCollectionElement.setAttribute("name", "col-Collection");
    colCollectionElement.setAttribute("type", "tns:col-Collection");
    schema.appendChild(colCollectionElement);
    /*-----------------------------------*/
    /*----------- Map Objects -----------*/
    /*-----------------------------------*/
    /* map-TreeMap Element */
    Element mapTreeMapElement = document.createElement("xsd:element");
    mapTreeMapElement.setAttribute("name", "map-TreeMap");
    mapTreeMapElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapTreeMapElement);
    /* map-WeakHashMap Element */
    Element mapWeakHashMapElement = document.createElement("xsd:element");
    mapWeakHashMapElement.setAttribute("name", "map-WeakHashMap");
    mapWeakHashMapElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapWeakHashMapElement);
    /* map-Hashtable Element */
    Element mapHashtableElement = document.createElement("xsd:element");
    mapHashtableElement.setAttribute("name", "map-Hashtable");
    mapHashtableElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapHashtableElement);
    /* map-Properties Element */
    Element mapPropertiesElement = document.createElement("xsd:element");
    mapPropertiesElement.setAttribute("name", "map-Properties");
    mapPropertiesElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapPropertiesElement);
    /* map-HashMap Element */
    Element mapHashMapElement = document.createElement("xsd:element");
    mapHashMapElement.setAttribute("name", "map-HashMap");
    mapHashMapElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapHashMapElement);
    /* map-Map Element */
    Element mapMapElement = document.createElement("xsd:element");
    mapMapElement.setAttribute("name", "map-Map");
    mapMapElement.setAttribute("type", "tns:map-Map");
    schema.appendChild(mapMapElement);
    /* map-Entry Element */
    Element mapEntryElement = document.createElement("xsd:element");
    mapEntryElement.setAttribute("name", "map-Entry");
    mapEntryElement.setAttribute("type", "tns:map-Entry");
    schema.appendChild(mapEntryElement);
    /* map-Key Element */
    Element mapKeyElement = document.createElement("xsd:element");
    mapKeyElement.setAttribute("name", "map-Key");
    mapKeyElement.setAttribute("type", "tns:map-Key");
    schema.appendChild(mapKeyElement);
    /* map-Value Element */
    Element mapValueElement = document.createElement("xsd:element");
    mapValueElement.setAttribute("name", "map-Value");
    mapValueElement.setAttribute("type", "tns:map-Value");
    schema.appendChild(mapValueElement);
    /* eepk- Element */
    Element eepkElement = document.createElement("xsd:element");
    eepkElement.setAttribute("name", "eepk-");
    eepkElement.setAttribute("type", "tns:map-Map");
    Element eepkElement0 = document.createElement("xsd:annotation");
    eepkElement.appendChild(eepkElement0);
    Element eepkElement1 = document.createElement("xsd:documentation");
    eepkElement0.appendChild(eepkElement1);
    eepkElement1.setTextContent("The name of element need to be appended with name of entity such as eepk-Product for Product entity.");
    schema.appendChild(eepkElement);
    /* eeval- Element */
    Element eevalElement = document.createElement("xsd:element");
    eevalElement.setAttribute("name", "eeval-");
    eevalElement.setAttribute("type", "tns:map-Map");
    Element eevalElement0 = document.createElement("xsd:annotation");
    eevalElement.appendChild(eevalElement0);
    Element eevalElement1 = document.createElement("xsd:documentation");
    eevalElement0.appendChild(eevalElement1);
    eevalElement1.setTextContent("The name of element need to be appended with name of entity such as eeval-Product for Product entity.");
    schema.appendChild(eevalElement);
    /*-----------------------------------*/
    /*----------- Custom Objects -----------*/
    /*-----------------------------------*/
    /* cus-obj Element */
    Element cusObjElement = document.createElement("xsd:element");
    cusObjElement.setAttribute("name", "cus-obj");
    Element cusObjElement0 = document.createElement("xsd:annotation");
    cusObjElement.appendChild(cusObjElement0);
    Element cusObjElement1 = document.createElement("xsd:documentation");
    cusObjElement0.appendChild(cusObjElement1);
    cusObjElement1.setTextContent("Object content is hex encoded so does not need to be in a CDATA block.");
    schema.appendChild(cusObjElement);
    /*-----------------------------------*/
    /*---------- Complex Types ----------*/
    /*-----------------------------------*/
    /* map-Map Complex Type */
    Element mapMapComplexType = document.createElement("xsd:complexType");
    mapMapComplexType.setAttribute("name", "map-Map");
    Element mapMapComplexType0 = document.createElement("xsd:sequence");
    mapMapComplexType.appendChild(mapMapComplexType0);
    Element mapMapComplexType1 = document.createElement("xsd:element");
    mapMapComplexType1.setAttribute("ref", "tns:map-Entry");
    mapMapComplexType1.setAttribute("minOccurs", "0");
    mapMapComplexType1.setAttribute("maxOccurs", "unbounded");
    mapMapComplexType0.appendChild(mapMapComplexType1);
    schema.appendChild(mapMapComplexType);
    /* map-Entry Complex Type */
    Element mapEntryComplexType = document.createElement("xsd:complexType");
    mapEntryComplexType.setAttribute("name", "map-Entry");
    Element mapEntryComplexType0 = document.createElement("xsd:sequence");
    mapEntryComplexType.appendChild(mapEntryComplexType0);
    Element mapEntryComplexType1 = document.createElement("xsd:element");
    mapEntryComplexType1.setAttribute("ref", "tns:map-Key");
    mapEntryComplexType1.setAttribute("minOccurs", "1");
    mapEntryComplexType1.setAttribute("maxOccurs", "1");
    mapEntryComplexType0.appendChild(mapEntryComplexType1);
    Element mapEntryComplexType2 = document.createElement("xsd:element");
    mapEntryComplexType2.setAttribute("ref", "tns:map-Value");
    mapEntryComplexType2.setAttribute("minOccurs", "1");
    mapEntryComplexType2.setAttribute("maxOccurs", "1");
    mapEntryComplexType0.appendChild(mapEntryComplexType2);
    schema.appendChild(mapEntryComplexType);
    /* map-Key Complex Type */
    Element mapKeyComplexType = document.createElement("xsd:complexType");
    mapKeyComplexType.setAttribute("name", "map-Key");
    Element mapKeyComplexType0 = document.createElement("xsd:all");
    mapKeyComplexType.appendChild(mapKeyComplexType0);
    Element mapKeyComplexType1 = document.createElement("xsd:element");
    mapKeyComplexType1.setAttribute("ref", "tns:std-String");
    mapKeyComplexType1.setAttribute("minOccurs", "1");
    mapKeyComplexType1.setAttribute("maxOccurs", "1");
    mapKeyComplexType0.appendChild(mapKeyComplexType1);
    schema.appendChild(mapKeyComplexType);
    /* map-Value Complex Type */
    Element mapValueComplexType = document.createElement("xsd:complexType");
    mapValueComplexType.setAttribute("name", "map-Value");
    Element mapValueComplexType0 = document.createElement("xsd:choice");
    mapValueComplexType.appendChild(mapValueComplexType0);
    Element mapValueComplexTypeNull = document.createElement("xsd:element");
    mapValueComplexTypeNull.setAttribute("ref", "tns:null");
    mapValueComplexTypeNull.setAttribute("minOccurs", "1");
    mapValueComplexTypeNull.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexTypeNull);
    Element mapValueComplexType1 = document.createElement("xsd:element");
    mapValueComplexType1.setAttribute("ref", "tns:std-String");
    mapValueComplexType1.setAttribute("minOccurs", "1");
    mapValueComplexType1.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType1);
    Element mapValueComplexType2 = document.createElement("xsd:element");
    mapValueComplexType2.setAttribute("ref", "tns:std-Integer");
    mapValueComplexType2.setAttribute("minOccurs", "1");
    mapValueComplexType2.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType2);
    Element mapValueComplexType3 = document.createElement("xsd:element");
    mapValueComplexType3.setAttribute("ref", "tns:std-Long");
    mapValueComplexType3.setAttribute("minOccurs", "1");
    mapValueComplexType3.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType3);
    Element mapValueComplexType4 = document.createElement("xsd:element");
    mapValueComplexType4.setAttribute("ref", "tns:std-Float");
    mapValueComplexType4.setAttribute("minOccurs", "1");
    mapValueComplexType4.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType4);
    Element mapValueComplexType5 = document.createElement("xsd:element");
    mapValueComplexType5.setAttribute("ref", "tns:std-Double");
    mapValueComplexType5.setAttribute("minOccurs", "1");
    mapValueComplexType5.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType5);
    Element mapValueComplexType6 = document.createElement("xsd:element");
    mapValueComplexType6.setAttribute("ref", "tns:std-Boolean");
    mapValueComplexType6.setAttribute("minOccurs", "1");
    mapValueComplexType6.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType6);
    Element mapValueComplexType7 = document.createElement("xsd:element");
    mapValueComplexType7.setAttribute("ref", "tns:std-Locale");
    mapValueComplexType7.setAttribute("minOccurs", "1");
    mapValueComplexType7.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType7);
    Element mapValueComplexType8 = document.createElement("xsd:element");
    mapValueComplexType8.setAttribute("ref", "tns:sql-Timestamp");
    mapValueComplexType8.setAttribute("minOccurs", "1");
    mapValueComplexType8.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType8);
    Element mapValueComplexType9 = document.createElement("xsd:element");
    mapValueComplexType9.setAttribute("ref", "tns:sql-Date");
    mapValueComplexType9.setAttribute("minOccurs", "1");
    mapValueComplexType9.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType9);
    Element mapValueComplexType10 = document.createElement("xsd:element");
    mapValueComplexType10.setAttribute("ref", "tns:sql-Time");
    mapValueComplexType10.setAttribute("minOccurs", "1");
    mapValueComplexType10.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType10);
    Element mapValueComplexType11 = document.createElement("xsd:element");
    mapValueComplexType11.setAttribute("ref", "tns:col-ArrayList");
    mapValueComplexType11.setAttribute("minOccurs", "1");
    mapValueComplexType11.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType11);
    Element mapValueComplexType12 = document.createElement("xsd:element");
    mapValueComplexType12.setAttribute("ref", "tns:col-LinkedList");
    mapValueComplexType12.setAttribute("minOccurs", "1");
    mapValueComplexType12.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType12);
    Element mapValueComplexType13 = document.createElement("xsd:element");
    mapValueComplexType13.setAttribute("ref", "tns:col-Stack");
    mapValueComplexType13.setAttribute("minOccurs", "1");
    mapValueComplexType13.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType13);
    Element mapValueComplexType14 = document.createElement("xsd:element");
    mapValueComplexType14.setAttribute("ref", "tns:col-Vector");
    mapValueComplexType14.setAttribute("minOccurs", "1");
    mapValueComplexType14.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType14);
    Element mapValueComplexType15 = document.createElement("xsd:element");
    mapValueComplexType15.setAttribute("ref", "tns:col-TreeSet");
    mapValueComplexType15.setAttribute("minOccurs", "1");
    mapValueComplexType15.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType15);
    Element mapValueComplexType16 = document.createElement("xsd:element");
    mapValueComplexType16.setAttribute("ref", "tns:col-HashSet");
    mapValueComplexType16.setAttribute("minOccurs", "1");
    mapValueComplexType16.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType16);
    Element mapValueComplexType17 = document.createElement("xsd:element");
    mapValueComplexType17.setAttribute("ref", "tns:col-Collection");
    mapValueComplexType17.setAttribute("minOccurs", "1");
    mapValueComplexType17.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType17);
    Element mapValueComplexType18 = document.createElement("xsd:element");
    mapValueComplexType18.setAttribute("ref", "tns:map-HashMap");
    mapValueComplexType18.setAttribute("minOccurs", "1");
    mapValueComplexType18.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType18);
    Element mapValueComplexType19 = document.createElement("xsd:element");
    mapValueComplexType19.setAttribute("ref", "tns:map-Properties");
    mapValueComplexType19.setAttribute("minOccurs", "1");
    mapValueComplexType19.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType19);
    Element mapValueComplexType20 = document.createElement("xsd:element");
    mapValueComplexType20.setAttribute("ref", "tns:map-Hashtable");
    mapValueComplexType20.setAttribute("minOccurs", "1");
    mapValueComplexType20.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType20);
    Element mapValueComplexType21 = document.createElement("xsd:element");
    mapValueComplexType21.setAttribute("ref", "tns:map-WeakHashMap");
    mapValueComplexType21.setAttribute("minOccurs", "1");
    mapValueComplexType21.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType21);
    Element mapValueComplexType22 = document.createElement("xsd:element");
    mapValueComplexType22.setAttribute("ref", "tns:map-TreeMap");
    mapValueComplexType22.setAttribute("minOccurs", "1");
    mapValueComplexType22.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType22);
    Element mapValueComplexType23 = document.createElement("xsd:element");
    mapValueComplexType23.setAttribute("ref", "tns:map-Map");
    mapValueComplexType23.setAttribute("minOccurs", "1");
    mapValueComplexType23.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType23);
    Element mapValueComplexType24 = document.createElement("xsd:element");
    mapValueComplexType24.setAttribute("ref", "tns:eepk-");
    mapValueComplexType24.setAttribute("minOccurs", "1");
    mapValueComplexType24.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType24);
    Element mapValueComplexType25 = document.createElement("xsd:element");
    mapValueComplexType25.setAttribute("ref", "tns:eeval-");
    mapValueComplexType25.setAttribute("minOccurs", "1");
    mapValueComplexType25.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType25);
    schema.appendChild(mapValueComplexType);
    Element mapValueComplexType26 = document.createElement("xsd:element");
    mapValueComplexType26.setAttribute("ref", "tns:std-BigDecimal");
    mapValueComplexType26.setAttribute("minOccurs", "1");
    mapValueComplexType26.setAttribute("maxOccurs", "1");
    mapValueComplexType0.appendChild(mapValueComplexType26);
    schema.appendChild(mapValueComplexType);
    /* col-Collection Complex Type */
    Element colCollectionComplexType = document.createElement("xsd:complexType");
    colCollectionComplexType.setAttribute("name", "col-Collection");
    Element colCollectionComplexType0 = document.createElement("xsd:choice");
    colCollectionComplexType.appendChild(colCollectionComplexType0);
    Element colCollectionComplexTypeNull = document.createElement("xsd:element");
    colCollectionComplexTypeNull.setAttribute("ref", "tns:null");
    colCollectionComplexTypeNull.setAttribute("minOccurs", "0");
    colCollectionComplexTypeNull.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexTypeNull);
    Element colCollectionComplexType1 = document.createElement("xsd:element");
    colCollectionComplexType1.setAttribute("ref", "tns:std-String");
    colCollectionComplexType1.setAttribute("minOccurs", "0");
    colCollectionComplexType1.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType1);
    Element colCollectionComplexType2 = document.createElement("xsd:element");
    colCollectionComplexType2.setAttribute("ref", "tns:std-Integer");
    colCollectionComplexType2.setAttribute("minOccurs", "0");
    colCollectionComplexType2.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType2);
    Element colCollectionComplexType3 = document.createElement("xsd:element");
    colCollectionComplexType3.setAttribute("ref", "tns:std-Long");
    colCollectionComplexType3.setAttribute("minOccurs", "0");
    colCollectionComplexType3.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType3);
    Element colCollectionComplexType4 = document.createElement("xsd:element");
    colCollectionComplexType4.setAttribute("ref", "tns:std-Float");
    colCollectionComplexType4.setAttribute("minOccurs", "0");
    colCollectionComplexType4.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType4);
    Element colCollectionComplexType5 = document.createElement("xsd:element");
    colCollectionComplexType5.setAttribute("ref", "tns:std-Double");
    colCollectionComplexType5.setAttribute("minOccurs", "0");
    colCollectionComplexType5.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType5);
    Element colCollectionComplexType6 = document.createElement("xsd:element");
    colCollectionComplexType6.setAttribute("ref", "tns:std-Boolean");
    colCollectionComplexType6.setAttribute("minOccurs", "0");
    colCollectionComplexType6.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType6);
    Element colCollectionComplexType7 = document.createElement("xsd:element");
    colCollectionComplexType7.setAttribute("ref", "tns:std-Locale");
    colCollectionComplexType7.setAttribute("minOccurs", "0");
    colCollectionComplexType7.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType7);
    Element colCollectionComplexType8 = document.createElement("xsd:element");
    colCollectionComplexType8.setAttribute("ref", "tns:sql-Timestamp");
    colCollectionComplexType8.setAttribute("minOccurs", "0");
    colCollectionComplexType8.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType8);
    Element colCollectionComplexType9 = document.createElement("xsd:element");
    colCollectionComplexType9.setAttribute("ref", "tns:sql-Date");
    colCollectionComplexType9.setAttribute("minOccurs", "0");
    colCollectionComplexType9.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType9);
    Element colCollectionComplexType10 = document.createElement("xsd:element");
    colCollectionComplexType10.setAttribute("ref", "tns:sql-Time");
    colCollectionComplexType10.setAttribute("minOccurs", "0");
    colCollectionComplexType10.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType10);
    Element colCollectionComplexType11 = document.createElement("xsd:element");
    colCollectionComplexType11.setAttribute("ref", "tns:col-ArrayList");
    colCollectionComplexType11.setAttribute("minOccurs", "0");
    colCollectionComplexType11.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType11);
    Element colCollectionComplexType12 = document.createElement("xsd:element");
    colCollectionComplexType12.setAttribute("ref", "tns:col-LinkedList");
    colCollectionComplexType12.setAttribute("minOccurs", "0");
    colCollectionComplexType12.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType12);
    Element colCollectionComplexType13 = document.createElement("xsd:element");
    colCollectionComplexType13.setAttribute("ref", "tns:col-Stack");
    colCollectionComplexType13.setAttribute("minOccurs", "0");
    colCollectionComplexType13.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType13);
    Element colCollectionComplexType14 = document.createElement("xsd:element");
    colCollectionComplexType14.setAttribute("ref", "tns:col-Vector");
    colCollectionComplexType14.setAttribute("minOccurs", "0");
    colCollectionComplexType14.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType14);
    Element colCollectionComplexType15 = document.createElement("xsd:element");
    colCollectionComplexType15.setAttribute("ref", "tns:col-TreeSet");
    colCollectionComplexType15.setAttribute("minOccurs", "0");
    colCollectionComplexType15.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType15);
    Element colCollectionComplexType16 = document.createElement("xsd:element");
    colCollectionComplexType16.setAttribute("ref", "tns:col-HashSet");
    colCollectionComplexType16.setAttribute("minOccurs", "0");
    colCollectionComplexType16.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType16);
    Element colCollectionComplexType17 = document.createElement("xsd:element");
    colCollectionComplexType17.setAttribute("ref", "tns:col-Collection");
    colCollectionComplexType17.setAttribute("minOccurs", "0");
    colCollectionComplexType17.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType17);
    Element colCollectionComplexType18 = document.createElement("xsd:element");
    colCollectionComplexType18.setAttribute("ref", "tns:map-HashMap");
    colCollectionComplexType18.setAttribute("minOccurs", "0");
    colCollectionComplexType18.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType18);
    Element colCollectionComplexType19 = document.createElement("xsd:element");
    colCollectionComplexType19.setAttribute("ref", "tns:map-Properties");
    colCollectionComplexType19.setAttribute("minOccurs", "0");
    colCollectionComplexType19.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType19);
    Element colCollectionComplexType20 = document.createElement("xsd:element");
    colCollectionComplexType20.setAttribute("ref", "tns:map-Hashtable");
    colCollectionComplexType20.setAttribute("minOccurs", "0");
    colCollectionComplexType20.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType20);
    Element colCollectionComplexType21 = document.createElement("xsd:element");
    colCollectionComplexType21.setAttribute("ref", "tns:map-WeakHashMap");
    colCollectionComplexType21.setAttribute("minOccurs", "0");
    colCollectionComplexType21.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType21);
    Element colCollectionComplexType22 = document.createElement("xsd:element");
    colCollectionComplexType22.setAttribute("ref", "tns:map-TreeMap");
    colCollectionComplexType22.setAttribute("minOccurs", "0");
    colCollectionComplexType22.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType22);
    Element colCollectionComplexType23 = document.createElement("xsd:element");
    colCollectionComplexType23.setAttribute("ref", "tns:map-Map");
    colCollectionComplexType23.setAttribute("minOccurs", "0");
    colCollectionComplexType23.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType23);
    Element colCollectionComplexType24 = document.createElement("xsd:element");
    colCollectionComplexType24.setAttribute("ref", "tns:eepk-");
    colCollectionComplexType24.setAttribute("minOccurs", "0");
    colCollectionComplexType24.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType24);
    Element colCollectionComplexType25 = document.createElement("xsd:element");
    colCollectionComplexType25.setAttribute("ref", "tns:eeval-");
    colCollectionComplexType25.setAttribute("minOccurs", "0");
    colCollectionComplexType25.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType25);
    schema.appendChild(colCollectionComplexType);
    Element colCollectionComplexType26 = document.createElement("xsd:element");
    colCollectionComplexType26.setAttribute("ref", "tns:std-BigDecimal");
    colCollectionComplexType26.setAttribute("minOccurs", "0");
    colCollectionComplexType26.setAttribute("maxOccurs", "unbounded");
    colCollectionComplexType0.appendChild(colCollectionComplexType26);
    schema.appendChild(colCollectionComplexType);
    types.setDocumentationElement(schema);
    return types;
}
Also used : Types(javax.wsdl.Types) Element(org.w3c.dom.Element)

Example 10 with Types

use of javax.wsdl.Types in project tomee by apache.

the class CommonsSchemaLoader method addImportsFromDefinition.

private void addImportsFromDefinition(Definition definition) throws OpenEJBException {
    Types types = definition.getTypes();
    if (types != null) {
        for (Object extensibilityElement : types.getExtensibilityElements()) {
            if (extensibilityElement instanceof Schema) {
                Schema unknownExtensibilityElement = (Schema) extensibilityElement;
                QName elementType = unknownExtensibilityElement.getElementType();
                if (new QName("http://www.w3.org/2001/XMLSchema", "schema").equals(elementType)) {
                    Element element = unknownExtensibilityElement.getElement();
                    xmlSchemaCollection.read(element);
                }
            } else if (extensibilityElement instanceof UnknownExtensibilityElement) {
                // This is allegedly obsolete as of axis-wsdl4j-1.2-RC3.jar which includes the Schema extension above.
                // The change notes imply that imported schemas should end up in Schema elements.  They don't, so this is still needed.
                UnknownExtensibilityElement unknownExtensibilityElement = (UnknownExtensibilityElement) extensibilityElement;
                Element element = unknownExtensibilityElement.getElement();
                String elementNamespace = element.getNamespaceURI();
                String elementLocalName = element.getNodeName();
                if ("http://www.w3.org/2001/XMLSchema".equals(elementNamespace) && "schema".equals(elementLocalName)) {
                    xmlSchemaCollection.read(element);
                }
            }
        }
    }
    // noinspection unchecked
    Map<String, List<Import>> imports = definition.getImports();
    if (imports != null) {
        for (Map.Entry<String, List<Import>> entry : imports.entrySet()) {
            String namespaceURI = entry.getKey();
            List<Import> importList = entry.getValue();
            for (Import anImport : importList) {
                // according to the 1.1 jwsdl mr shcema imports are supposed to show up here,
                // but according to the 1.0 spec there is supposed to be no Definition.
                Definition importedDef = anImport.getDefinition();
                if (importedDef != null) {
                    addImportsFromDefinition(importedDef);
                } else {
                    LOG.warn("Missing definition in import for namespace " + namespaceURI);
                }
            }
        }
    }
}
Also used : Types(javax.wsdl.Types) Import(javax.wsdl.Import) QName(javax.xml.namespace.QName) Schema(javax.wsdl.extensions.schema.Schema) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map)

Aggregations

Types (javax.wsdl.Types)17 Schema (javax.wsdl.extensions.schema.Schema)14 XmlSchema (org.apache.ws.commons.schema.XmlSchema)7 Element (org.w3c.dom.Element)7 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)6 SchemaImport (javax.wsdl.extensions.schema.SchemaImport)6 QName (javax.xml.namespace.QName)6 List (java.util.List)3 Import (javax.wsdl.Import)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Definition (javax.wsdl.Definition)2 Message (javax.wsdl.Message)2 WSDLException (javax.wsdl.WSDLException)2 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)2 SchemaInfo (org.apache.cxf.service.model.SchemaInfo)2 Test (org.junit.Test)2 Gson (com.google.gson.Gson)1