Search in sources :

Example 11 with XmlQName

use of com.twinsoft.convertigo.beans.common.XmlQName in project convertigo by convertigo.

the class Migration7_0_0 method handleRequestableVariable.

private static void handleRequestableVariable(List<RequestableVariable> variables) {
    for (RequestableVariable variable : variables) {
        QName qName = XmlSchemaUtils.getSchemaDataTypeName(variable.getSchemaType());
        variable.setXmlTypeAffectation(new XmlQName(qName));
    }
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) QName(javax.xml.namespace.QName) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable)

Example 12 with XmlQName

use of com.twinsoft.convertigo.beans.common.XmlQName in project convertigo by convertigo.

the class ElementStep method toString.

@Override
public String toString() {
    String label = "";
    try {
        label += " " + getLabel();
    } catch (EngineException e) {
    }
    XmlQName xmlQName = getXmlElementRefAffectation();
    xmlQName = xmlQName.isEmpty() ? getXmlComplexTypeAffectation() : xmlQName;
    return "<" + getStepNodeName() + ">" + label + " " + xmlQName.getQName();
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 13 with XmlQName

use of com.twinsoft.convertigo.beans.common.XmlQName in project convertigo by convertigo.

the class XmlHttpTransaction method writeSchemaToFile.

/*
	private void dumpByteArray(byte[] data)
	{
		byte	c[] = new byte[1];
		
		for (int j=0; j <data.length; j+= 80) {
			String	displayH ="";
			String	displayC ="";
			
			for (int i=0; i < 80; i++) {
				if ((i+j) < data.length) {
					byte b = data[i+j];
					if (b < 16) {
						displayH += "0" + Integer.toHexString(b) + " ";
					} else {
						displayH += Integer.toHexString(b) + " ";;
					}
					c[0] = b;
					displayC += new String(c) + "  ";
				}
			}
			Engine.logBeans.debug(displayH);
			Engine.logBeans.debug(displayC);
		}
	}
	*/
@Override
public void writeSchemaToFile(String xsdTypes) {
    XmlQName xmlQName = getXmlElementRefAffectation();
    boolean bRPC = getResponseElementQName().indexOf(";") != -1;
    if (!xmlQName.isEmpty() || bRPC) {
        try {
            XmlSchema xmlSchema = createSchema();
            String ns = getElementRefAffectation().getNamespaceURI();
            XmlSchemaCollection collection = Engine.theApp.schemaManager.getSchemasForProject(getProject().getName());
            XmlSchema referenced = collection.schemaForNamespace(ns);
            if (referenced != null) {
                if (ns.equals(xmlSchema.getTargetNamespace())) {
                    XmlSchemaInclude xmlSchemaInclude = new XmlSchemaInclude();
                    xmlSchemaInclude.setSchemaLocation(referenced.getSourceURI());
                    xmlSchemaInclude.setSchema(referenced);
                    XmlSchemaUtils.add(xmlSchema, xmlSchemaInclude);
                } else {
                    XmlSchemaImport xmlSchemaImport = new XmlSchemaImport();
                    xmlSchemaImport.setNamespace(referenced.getTargetNamespace());
                    xmlSchemaImport.setSchemaLocation(referenced.getSourceURI());
                    xmlSchemaImport.setSchema(referenced);
                    XmlSchemaUtils.add(xmlSchema, xmlSchemaImport);
                }
            }
            new File(getSchemaFileDirPath()).mkdirs();
            SchemaUtils.saveSchema(getSchemaFilePath(), xmlSchema);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } else {
        super.writeSchemaToFile(xsdTypes);
    }
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaInclude(org.apache.ws.commons.schema.XmlSchemaInclude) XmlSchemaImport(org.apache.ws.commons.schema.XmlSchemaImport) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection) File(java.io.File) SOAPException(javax.xml.soap.SOAPException) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException)

Example 14 with XmlQName

use of com.twinsoft.convertigo.beans.common.XmlQName in project convertigo by convertigo.

the class XmlHttpTransaction method addSchemaResponseDataType.

@Override
protected XmlSchemaComplexType addSchemaResponseDataType(XmlSchema xmlSchema) {
    XmlSchemaComplexType xmlSchemaComplexType = super.addSchemaResponseDataType(xmlSchema);
    XmlQName xmlQName = getXmlElementRefAffectation();
    boolean bRPC = getResponseElementQName().indexOf(";") != -1;
    if (!xmlQName.isEmpty() || bRPC) {
        XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaComplexType.getParticle();
        if (xmlSchemaSequence == null)
            xmlSchemaSequence = new XmlSchemaSequence();
        XmlSchemaElement xmlSchemaElement = new XmlSchemaElement();
        if (bRPC) {
            // response is based on an element defined with a type
            // operationResponse element name; element name; element type
            String reqn = getResponseElementQName();
            String opName = getName() + "Response", eltName = "response", eltType = "{" + Constants.URI_2001_SCHEMA_XSD + "}string";
            QName typeName = Constants.XSD_STRING;
            int i, j, k, z;
            if ((i = reqn.indexOf(";")) != -1) {
                opName = reqn.substring(0, i);
                if ((j = reqn.indexOf(";", i + 1)) != -1) {
                    eltName = reqn.substring(i + 1, j);
                    eltType = reqn.substring(j + 1);
                    if ((k = eltType.indexOf("{")) != -1) {
                        if ((z = eltType.indexOf("}")) != -1) {
                            String ns = eltType.substring(k + 1, z);
                            String local = eltType.substring(z + 1);
                            typeName = new QName(ns, local);
                        }
                    }
                }
            }
            xmlSchemaElement.setName(opName);
            XmlSchemaComplexType cType = new XmlSchemaComplexType(xmlSchema);
            XmlSchemaSequence seq = new XmlSchemaSequence();
            XmlSchemaElement elem = new XmlSchemaElement();
            elem.setName(eltName);
            elem.setSchemaTypeName(typeName);
            seq.getItems().add(elem);
            cType.setParticle(seq);
            xmlSchemaElement.setSchemaType(cType);
        } else {
            xmlSchemaElement.setName("");
            xmlSchemaElement.setRefName(xmlQName.getQName());
            xmlSchemaElement.setMinOccurs(0);
        }
        if (isErrorOnSoapFault()) {
            xmlSchemaElement.setMinOccurs(0);
        }
        xmlSchemaSequence.getItems().add(xmlSchemaElement);
        xmlSchemaComplexType.setParticle(xmlSchemaSequence);
    }
    return xmlSchemaComplexType;
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlQName(com.twinsoft.convertigo.beans.common.XmlQName) QName(javax.xml.namespace.QName) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 15 with XmlQName

use of com.twinsoft.convertigo.beans.common.XmlQName in project convertigo by convertigo.

the class XMLComplexStep method toString.

@Override
public String toString() {
    XmlQName xmlQName = getXmlElementRefAffectation();
    xmlQName = xmlQName.isEmpty() ? getXmlComplexTypeAffectation() : xmlQName;
    String tag = "<" + getStepNodeName() + "> " + xmlQName.getQName();
    return tag;
}
Also used : XmlQName(com.twinsoft.convertigo.beans.common.XmlQName)

Aggregations

XmlQName (com.twinsoft.convertigo.beans.common.XmlQName)16 QName (javax.xml.namespace.QName)6 EngineException (com.twinsoft.convertigo.engine.EngineException)5 XmlSchema (org.apache.ws.commons.schema.XmlSchema)4 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)4 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)4 XmlHttpTransaction (com.twinsoft.convertigo.beans.transactions.XmlHttpTransaction)3 File (java.io.File)3 IOException (java.io.IOException)3 XmlSchemaCollection (org.apache.ws.commons.schema.XmlSchemaCollection)3 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)3 Document (org.w3c.dom.Document)3 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)2 Connector (com.twinsoft.convertigo.beans.core.Connector)2 Transaction (com.twinsoft.convertigo.beans.core.Transaction)2 RequestableHttpVariable (com.twinsoft.convertigo.beans.variables.RequestableHttpVariable)2 RequestableVariable (com.twinsoft.convertigo.beans.variables.RequestableVariable)2 StringReader (java.io.StringReader)2 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)2 InputSource (org.xml.sax.InputSource)2