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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations