Example #1
0
 public InputStream getInputStream() throws IOException {
   try {
     if (source != null) {
       return new FileInputStream(source);
     }
     if (SchemaUtils.isInstanceOf(schemaType, XmlHexBinary.type)) {
       return new ByteArrayInputStream(Hex.decodeHex(content.toCharArray()));
     } else if (SchemaUtils.isInstanceOf(schemaType, XmlBase64Binary.type)) {
       return new ByteArrayInputStream(Base64.decodeBase64(content.getBytes()));
     } else if (SchemaUtils.isAnyType(schemaType)) {
       return new ByteArrayInputStream(content.getBytes());
     } else throw new IOException("Invalid type for XOPPartDataSource; " + schemaType.getName());
   } catch (Exception e) {
     SoapUI.logError(e);
     throw new IOException(e.toString());
   }
 }
  public Collection<String> getDefinedNamespaces() throws Exception {
    Set<String> namespaces = new HashSet<String>();

    SchemaTypeSystem schemaTypes = getSchemaTypeSystem();
    if (schemaTypes != null) {
      namespaces.addAll(SchemaUtils.extractNamespaces(getSchemaTypeSystem(), true));
    }

    namespaces.add(getTargetNamespace());

    return namespaces;
  }
Example #3
0
  public static Map<String, XmlObject> getDefinitionParts(String wadlUrl) {
    Map<String, XmlObject> result = new HashMap<String, XmlObject>();

    try {
      return SchemaUtils.getSchemas(wadlUrl, new UrlSchemaLoader(wadlUrl));

      // URL url = new URL(wadlUrl);
      // ApplicationDocument applicationDocument =
      // ApplicationDocument.Factory.parse(url);
      // result.put(url.getPath(), applicationDocument);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return result;
  }
 public void loadSchemaTypes(DefinitionLoader loader) throws SchemaException {
   schemaTypes = SchemaUtils.loadSchemaTypes(loader.getBaseURI(), loader);
   schemaTypeLoader =
       XmlBeans.typeLoaderUnion(
           new SchemaTypeLoader[] {schemaTypes, XmlBeans.getBuiltinTypeSystem()});
 }