Search in sources :

Example 46 with XmlSchemaComplexType

use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.

the class XmlHttpTransaction method generateWsdlType.

@Override
public String generateWsdlType(Document document) throws Exception {
    XmlQName xmlQName = getXmlElementRefAffectation();
    String reqn = getResponseElementQName();
    if (!reqn.equals("") || !xmlQName.isEmpty()) {
        // String opName = getName()+"Response", eltName = "response", eltType = "xsd:string";
        // boolean useRef = true;
        // int index, index2;
        // if ((index = reqn.indexOf(";")) != -1) {
        // useRef = false;
        // opName = reqn.substring(0, index);
        // if ((index2 = reqn.indexOf(";", index+1)) != -1) {
        // eltName = reqn.substring(index+1,index2);
        // eltType = reqn.substring(index2+1);
        // }
        // }
        // 
        // String prefix = getXsdTypePrefix();
        // String xsdType = "";
        // xsdType += "<xsd:complexType name=\""+ prefix + getName() +"Response" +"\" >\n";
        // xsdType += "  <xsd:sequence>\n";
        // if (useRef)
        // xsdType += "    <xsd:element ref=\""+ reqn +"\"/>\n";
        // else {
        // xsdType += "    <xsd:element name=\""+ opName +"\">\n";
        // xsdType += "      <xsd:complexType>\n";
        // xsdType += "        <xsd:sequence>\n";
        // xsdType += "          <xsd:element name=\""+ eltName +"\" type=\""+ eltType +"\"/>\n";
        // xsdType += "        </xsd:sequence>\n";
        // xsdType += "      </xsd:complexType>\n";
        // xsdType += "    </xsd:element>\n";
        // }
        // xsdType += "  </xsd:sequence>\n";
        // xsdType += "</xsd:complexType>\n";
        String xsdType = "<xsd:complexType name=\"" + getXsdResponseElementName() + "\" />\n";
        try {
            XmlSchema xmlSchema = createSchema();
            XmlSchemaComplexType cType = (XmlSchemaComplexType) xmlSchema.getTypeByName(getXsdResponseTypeName());
            xsdType = cType.toString("xsd", 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return xsdType;
    }
    return super.generateWsdlType(document);
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) SOAPException(javax.xml.soap.SOAPException) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException)

Example 47 with XmlSchemaComplexType

use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.

the class SapJcoTransaction method addSchemaResponseDataType.

@Override
protected XmlSchemaComplexType addSchemaResponseDataType(XmlSchema xmlSchema) {
    XmlSchemaComplexType xmlSchemaComplexType = super.addSchemaResponseDataType(xmlSchema);
    XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaComplexType.getParticle();
    if (xmlSchemaSequence == null)
        xmlSchemaSequence = new XmlSchemaSequence();
    try {
        connector = ((SapJcoConnector) parent);
        SapJcoProviderImpl provider = connector.getSapJCoProvider();
        XmlSchemaElement sap_output = provider.addJCoFunctionResponseSchema(this, xmlSchema);
        xmlSchemaSequence.getItems().add(sap_output);
    } catch (Exception e) {
        Engine.logBeans.error("Unable to generate response schema for SapJcoTransaction named '" + getName() + "'", e);
    }
    xmlSchemaComplexType.setParticle(xmlSchemaSequence);
    return xmlSchemaComplexType;
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) SapJcoProviderImpl(com.twinsoft.convertigo.beans.connectors.SapJcoConnector.SapJcoProviderImpl) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) SapJcoConnector(com.twinsoft.convertigo.beans.connectors.SapJcoConnector) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 48 with XmlSchemaComplexType

use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.

the class AbstractCouchDbTransaction method addSchemaResponseDataType.

@Override
protected XmlSchemaComplexType addSchemaResponseDataType(XmlSchema xmlSchema) {
    XmlSchemaComplexType xmlSchemaComplexType = super.addSchemaResponseDataType(xmlSchema);
    XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaComplexType.getParticle();
    if (xmlSchemaSequence == null)
        xmlSchemaSequence = new XmlSchemaSequence();
    try {
        XmlSchemaElement couchdb_output = new XmlSchemaElement();
        couchdb_output.setName("couchdb_output");
        couchdb_output.setSchemaTypeName(getComplexTypeAffectation());
        xmlSchemaSequence.getItems().add(couchdb_output);
    } catch (Exception e) {
        Engine.logBeans.error("Unable to generate response schema for CouchDbTransaction named '" + getName() + "'", e);
    }
    xmlSchemaComplexType.setParticle(xmlSchemaSequence);
    return xmlSchemaComplexType;
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) JSONException(org.codehaus.jettison.json.JSONException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 49 with XmlSchemaComplexType

use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.

the class XMLGenerateDatesStep method getXmlSchemaObject.

@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
    XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
    if (!startDefinition.isEmpty() && !stopDefinition.isEmpty() && !daysDefinition.isEmpty()) {
        XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
        element.setType(cType);
        XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
        cType.setParticle(sequence);
        XmlSchemaElement date = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
        date.setName("date");
        date.setMinOccurs(0);
        date.setMaxOccurs(Long.MAX_VALUE);
        sequence.getItems().add(date);
        if (split) {
            cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
            date.setType(cType);
            sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
            cType.setParticle(sequence);
            XmlSchemaElement elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
            elt.setName("dayOfWeek");
            elt.setSchemaTypeName(Constants.XSD_STRING);
            sequence.getItems().add(elt);
            elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
            elt.setName("day");
            elt.setSchemaTypeName(Constants.XSD_STRING);
            sequence.getItems().add(elt);
            elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
            elt.setName("month");
            elt.setSchemaTypeName(Constants.XSD_STRING);
            sequence.getItems().add(elt);
            elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
            elt.setName("year");
            elt.setSchemaTypeName(Constants.XSD_STRING);
            sequence.getItems().add(elt);
        } else {
            date.setSchemaTypeName(getSimpleTypeAffectation());
        }
    }
    return element;
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 50 with XmlSchemaComplexType

use of org.apache.ws.commons.schema.XmlSchemaComplexType in project convertigo by convertigo.

the class TransactionXSDTypesDialogComposite method getTypesListFromXsd.

private ArrayList<String> getTypesListFromXsd() {
    ArrayList<String> types = new ArrayList<String>();
    try {
        String tns = transaction.getProject().getTargetNamespace();
        String projectName = transaction.getProject().getName();
        XmlSchema schema = Engine.theApp.schemaManager.getSchemaForProject(projectName);
        QName responseTypeQName = new QName(tns, transaction.getXsdResponseTypeName());
        XmlSchemaComplexType xmlSchemaType = (XmlSchemaComplexType) schema.getTypeByName(responseTypeQName);
        XmlSchemaParticle xmlSchemaParticle = xmlSchemaType.getParticle();
        if (xmlSchemaParticle != null && xmlSchemaParticle instanceof XmlSchemaSequence) {
            XmlSchemaObjectCollection xmlSchemaObjectCollection = ((XmlSchemaSequence) xmlSchemaParticle).getItems();
            for (int i = 0; i < xmlSchemaObjectCollection.getCount(); i++) {
                XmlSchemaObject xso = xmlSchemaObjectCollection.getItem(i);
                if (xso instanceof XmlSchemaElement) {
                    XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) xso;
                    String elName = xmlSchemaElement.getName();
                    QName elType = xmlSchemaElement.getSchemaTypeName();
                    String value = "<xsd:element name=\"" + elName + "\" type=\"" + elType.getPrefix() + ":" + elType.getLocalPart() + "\"/>";
                    types.add(value);
                }
            }
        }
    } catch (Exception e) {
    }
    return types;
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) ArrayList(java.util.ArrayList) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) Point(org.eclipse.swt.graphics.Point) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Aggregations

XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)136 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)101 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)71 QName (javax.xml.namespace.QName)59 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)33 XmlSchema (org.apache.ws.commons.schema.XmlSchema)32 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)31 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)23 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)20 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)18 Test (org.junit.Test)18 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)16 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)15 ArrayList (java.util.ArrayList)13 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)12 XmlSchemaSequenceMember (org.apache.ws.commons.schema.XmlSchemaSequenceMember)12 XmlSchemaSimpleContentExtension (org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension)12 XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)8 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)8 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)8