use of com.predic8.wsdl.Types in project service-proxy by membrane.
the class WSDLValidator method getSchemas.
@Override
protected List<Schema> getSchemas() {
WSDLParserContext ctx = new WSDLParserContext();
ctx.setInput(location);
try {
WSDLParser wsdlParser = new WSDLParser();
// System.out.println("Resolver----" + resourceResolver);
wsdlParser.setResourceResolver(resourceResolver.toExternalResolver().toExternalResolver());
List<Schema> schemaList = new ArrayList<Schema>();
for (Types t : wsdlParser.parse(ctx).getTypes()) schemaList.addAll(t.getSchemas());
return schemaList;
} catch (RuntimeException e) {
throw new IllegalArgumentException("Could not download the WSDL " + location + " or its dependent XML Schemas.", e);
}
}
use of com.predic8.wsdl.Types in project service-proxy by membrane.
the class HelpReference method handle.
/*
private int getId(String xsdTypeName) {
if (ids.containsKey(xsdTypeName))
return ids.get(xsdTypeName);
int id = Math.abs(xsdTypeName.hashCode());
if (idsReverse.containsKey(id))
throw new ProcessingException("ID-assigning algorithm failed (two XSD types got the same ID)");
ids.put(xsdTypeName, id);
idsReverse.put(id, xsdTypeName);
return id;
}
*/
private void handle(Model m, MainInfo main, ChildElementInfo cei) throws XMLStreamException {
xew.writeStartElement("child");
xew.writeAttribute("min", cei.isRequired() ? "1" : "0");
xew.writeAttribute("max", cei.isList() ? "unbounded" : "1");
handleDoc(cei);
SortedSet<String> possibilities = new TreeSet<String>();
for (ElementInfo ei : main.getChildElementDeclarations().get(cei.getTypeDeclaration()).getElementInfo()) {
possibilities.add(ei.getId());
}
for (String id : possibilities) {
xew.writeStartElement("possibility");
xew.writeAttribute("refId", id);
xew.writeEndElement();
}
if (cei.getAnnotation().allowForeign()) {
xew.writeStartElement("possibility");
xew.writeAttribute("foreign", "true");
xew.writeEndElement();
}
xew.writeEndElement();
}
use of com.predic8.wsdl.Types in project service-proxy by membrane.
the class AttributeInfo method analyze.
private void analyze(Types typeUtils) {
if (// already analyzed?
xsdType != null)
return;
if (getE().getParameters().size() != 1)
throw new ProcessingException("Setter is supposed to have 1 parameter.", getE());
VariableElement ve = getE().getParameters().get(0);
switch(ve.asType().getKind()) {
case INT:
xsdType = "spel_number";
return;
case LONG:
xsdType = "spel_number";
return;
case BOOLEAN:
xsdType = "spel_boolean";
return;
case DECLARED:
TypeElement e = (TypeElement) typeUtils.asElement(ve.asType());
if (e.getQualifiedName().toString().equals("java.lang.String")) {
xsdType = "xsd:string";
return;
}
if (e.getSuperclass().getKind() == TypeKind.DECLARED) {
TypeElement superClass = ((TypeElement) typeUtils.asElement(e.getSuperclass()));
if (superClass.getQualifiedName().toString().equals("java.lang.Enum")) {
isEnum = true;
// TODO: restriction, but be carefull about Spring EL usage, for example "#{config.XXX}"
xsdType = "xsd:string";
/*
* <xsd:attribute name=\"target\" use=\"optional\" default=\"body\">\r\n" +
* <xsd:simpleType>\r\n" +
* <xsd:restriction base=\"xsd:string\">\r\n" +
* <xsd:enumeration value=\"body\" />\r\n" +
* <xsd:enumeration value=\"header\" />\r\n" +
* </xsd:restriction>\r\n" +
* </xsd:simpleType>\r\n" +
* </xsd:attribute>\r\n"
*/
return;
}
}
isBeanReference = true;
xsdType = "xsd:string";
return;
default:
throw new ProcessingException("Not implemented: XSD type for " + ve.asType().getKind().toString(), this.getE());
}
}
Aggregations