Beispiel #1
0
  private boolean validatePartType(String namespace, String name, boolean isElement) {

    boolean partvalid = false;

    if (namespace.equals(WSDLConstants.NS_SCHEMA_XSD)) {
      if (isElement) {
        XmlSchemaElement schemaEle =
            schemaCollection.getElementByQName(new QName(WSDLConstants.NS_SCHEMA_XSD, name));
        partvalid = schemaEle != null ? true : false;
      } else {
        if ("anyType".equals(name)) {
          return true;
        }
        XmlSchemaType schemaType =
            schemaCollection.getTypeByQName(new QName(WSDLConstants.NS_SCHEMA_XSD, name));

        partvalid = schemaType != null ? true : false;
      }

    } else {
      if (isElement) {
        if (schemaCollection.getElementByQName(new QName(namespace, name)) != null) {
          partvalid = true;
        }
      } else {
        if (schemaCollection.getTypeByQName(new QName(namespace, name)) != null) {
          partvalid = true;
        }
      }
    }
    return partvalid;
  }
  private void buildMessage(
      MessageInfo minfo,
      javax.wsdl.Message msg,
      SchemaCollection schemas,
      int nextId,
      String partNameFilter) {
    for (Part part : cast(msg.getParts().values(), Part.class)) {

      if (StringUtils.isEmpty(partNameFilter) || part.getName().equals(partNameFilter)) {

        if (StringUtils.isEmpty(part.getName())) {
          throw new RuntimeException(
              "Problem with WSDL: part element in message "
                  + msg.getQName().getLocalPart()
                  + " does not specify a name.");
        }
        QName pqname = new QName(minfo.getName().getNamespaceURI(), part.getName());
        MessagePartInfo pi = minfo.getMessagePart(pqname);
        if (pi != null && pi.getMessageInfo().getName().equals(msg.getQName())) {
          continue;
        }
        pi = minfo.addOutOfBandMessagePart(pqname);

        if (!minfo.getName().equals(msg.getQName())) {
          pi.setMessageContainer(new MessageInfo(minfo.getOperation(), null, msg.getQName()));
        }

        if (part.getTypeName() != null) {
          pi.setTypeQName(part.getTypeName());
          pi.setElement(false);
          pi.setXmlSchema(schemas.getTypeByQName(part.getTypeName()));
        } else {
          pi.setElementQName(part.getElementName());
          pi.setElement(true);
          pi.setXmlSchema(schemas.getElementByQName(part.getElementName()));
        }
        pi.setProperty(OUT_OF_BAND_HEADER, Boolean.TRUE);
        pi.setProperty(HEADER, Boolean.TRUE);
        pi.setIndex(nextId);
        nextId++;
      }
    }
  }
Beispiel #3
0
 public static List<XmlSchemaAnnotated> getContentAttributes(
     XmlSchemaComplexType type, SchemaCollection collection) {
   List<XmlSchemaAnnotated> results = new ArrayList<XmlSchemaAnnotated>();
   QName baseTypeName = getBaseType(type);
   if (baseTypeName != null) {
     XmlSchemaComplexType baseType =
         (XmlSchemaComplexType) collection.getTypeByQName(baseTypeName);
     // recurse onto the base type ...
     results.addAll(getContentAttributes(baseType, collection));
     // and now process our sequence.
     List<XmlSchemaAttributeOrGroupRef> extAttrs = getContentAttributes(type);
     results.addAll(extAttrs);
     return results;
   } else {
     // no base type, the simple case.
     List<XmlSchemaAttributeOrGroupRef> attrs = type.getAttributes();
     results.addAll(attrs);
     return results;
   }
 }