Package javax.wsdl

Examples of javax.wsdl.Import


            }
        }
        for (Iterator iter = definition.getImports().values().iterator(); iter.hasNext();) {
            Vector values = (Vector)iter.next();
            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
                Import wsdlImport = (Import)valuesIter.next();
                modifySchemaImportsAndIncludes(wsdlImport.getDefinition(), name);
            }
        }
    }
View Full Code Here


    EntryContext entryContext)
    throws WSIException
  {

    // Getting wsdl:import
    Import im = (Import) entryContext.getEntry().getEntryDetail();

    try
    {
      // If there is no the "namespace" attribute in the import,
      // the assertion is not applicable
      if (im.getNamespaceURI() == null)
      {
        throw new AssertionNotApplicableException();
      }

      // If a namespace URI is relative or invalid, the assertion failed
      URI uri = new URI(im.getNamespaceURI());
      if (!uri.isAbsolute())
      {
        throw new AssertionFailException(
          im.getNamespaceURI() + " is relative URI.");
      }
    }
    catch (AssertionNotApplicableException anae)
    {
      result = AssertionResult.RESULT_NOT_APPLICABLE;
View Full Code Here

    else
    {
      for (int i = 0; i < wsdlImports.length; i++)
      {
        Import wsdlImport = wsdlImports[i];
        // Create entry
        entry = this.reporter.getReport().createEntry();
        entry.setEntryType(EntryType.getEntryType(TYPE_DESCRIPTION_IMPORT));
        entry.setReferenceID(wsdlImport.getNamespaceURI());
        entry.setEntryDetail(wsdlImport);

        // Set entry container
        entry.setEntryContainer(getEntryContainer(wsdlImport.getLocationURI()));

        // Process all of the import related test assertions
        processAssertions(
          classPrefix,
          new EntryContext(entry, candidate.getWsdlDocument()));
View Full Code Here

      list.addAll(targetNamespaceList);
   
    // Get list of imported WSDL documents
    Map importMap = definition.getImports();

    Import imp;

    // Add each imports targetNamespace to the list
    if (importMap != null && !importMap.isEmpty())
    {
      Iterator values = importMap.values().iterator();
      List importList;
      while (values.hasNext())
      {
        importList = (List) values.next();
        Iterator imports = importList.iterator();
        while (imports.hasNext())
        {
          imp = (Import) imports.next();
          if (imp != null && imp.getDefinition() != null)
            list.addAll(getSchemaNamespaceList(imp.getDefinition()));
        }
      }
    }

    return list;
View Full Code Here

        list.add(definition.getTargetNamespace());

      // Get list of imported WSDL documents
      Map importMap = definition.getImports();

      Import imp;

      // Add each imports targetNamespace to the list
      if (importMap != null && !importMap.isEmpty())
      {
        Iterator values = importMap.values().iterator();
        List importList;
        while (values.hasNext())
        {
          importList = (List) values.next();
          Iterator imports = importList.iterator();
          while (imports.hasNext())
          {
            imp = (Import) imports.next();
            if (imp != null && imp.getDefinition() != null)
            list.addAll(getWSDLTargetNamespaceList(imp.getDefinition(), alreadyProcessedDefinitions));
            // list.add(imp.getDefinition().getTargetNamespace());
          }
        }
      }
    }
View Full Code Here

      {
        List nextImportList = (List) (i.next());
        Iterator listIt = nextImportList.iterator();
        while (listIt.hasNext())
        {
          Import nextImport = (Import) listIt.next();
          if (nextImport != null)
          {
            importSet.add(nextImport);
            Definition def = nextImport.getDefinition();
             HashSet nestedImports = getAllImports(alreadyProcessedDefinitions, def);
            for (Iterator j = nestedImports.iterator(); j.hasNext();)
              importSet.add(j.next());
          }
        }
View Full Code Here

   
      }
    }
    Import importDef = super.parseImport(element, definition, map);
    addElementToList(element, importDef);*/
    Import import1 = definition.createImport();
    String s = DOMUtils.getAttribute(element, "namespace");
    String s1 = DOMUtils.getAttribute(element, "location");
    if (s != null)
      import1.setNamespaceURI(s);
    // ADD: check "location" attribute for empty
    // string to prevent self-defenition assigning
    if ((s1 != null) && (s1.length() > 0))
    {
      import1.setLocationURI(s1);
      if (importDocuments)
        try
        {
          String s2 = definition.getDocumentBaseURI();
          Definition definition1 = null;
          InputStream inputstream = null;
          InputSource inputsource = null;
          URL url = null;
          if (loc != null)
          {
            inputsource = loc.getImportInputSource(s2, s1);
            String s3 = loc.getLatestImportURI();
            definition1 = (Definition) map.get(s3);
          }
          else
          {
            URL url1 = s2 == null ? null : StringUtils.getURL(null, s2);
            url = StringUtils.getURL(url1, s1);
            definition1 = (Definition) map.get(url.toString());
            if (definition1 == null)
            {
              try
              {

                inputstream = url.openStream();
              }
              catch (IOException ex)
              {
                //import1.setLocationURI(null);
                addElementToList(element, import1);
                return import1;
              }
              if (inputstream != null)
                inputsource = new InputSource(inputstream);
            }
          }
          if (definition1 == null)
          {
            if (inputsource == null)
              throw new WSDLException(
                "OTHER_ERROR",
                "Unable to locate imported document at '"
                  + s1
                  + "'"
                  + (s2 != null ? ", relative to '" + s2 + "'." : "."));
            Document document = null;
            try
            {
              document = getDocument(inputsource, s1);
            }
            catch (WSDLException ex)
            {
              addElementToList(element, import1);
              return import1;
            }
            if (inputstream != null)
              inputstream.close();
            Element element2 = document.getDocumentElement();
            if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS, element2))
            {
              //if (verbose)
              //  System.out.println(
              //    "Retrieving document at '"
              //      + s1
              //      + "'"
              //      + (s2 != null ? ", relative to '" + s2 + "'." : "."));
              String s4 =
                loc == null
                  ? url == null
                  ? s1
                  : url.toString() : loc.getLatestImportURI();
              definition1 = readWSDL(s4, element2, map);
            }
            else
            {
              QName qname = QNameUtils.newQName(element2);
              if (SchemaConstants.XSD_QNAME_LIST.contains(qname))
              {
                WSDLFactory wsdlfactory =
                  factoryImplName == null
                    ? WSDLFactory.newInstance()
                    : WSDLFactory.newInstance(factoryImplName);
                definition1 = wsdlfactory.newDefinition();
                if (extReg != null)
                  definition1.setExtensionRegistry(extReg);
                String s5 =
                  loc == null
                    ? url == null
                    ? s1
                    : url.toString() : loc.getLatestImportURI();
                definition1.setDocumentBaseURI(s5);
                /* Don't add types element since it doesn't exist.  Adding it causes problems
                 * since it will add a types element for processing that does not exist.
                Types types = definition1.createTypes();
                UnknownExtensibilityElement unknownextensibilityelement =
                  new UnknownExtensibilityElement();
                unknownextensibilityelement.setElement(element2);
                types.addExtensibilityElement(
                  unknownextensibilityelement);
                definition1.setTypes(types);
                */
              }
            }
          }
          if (definition1 != null)
            import1.setDefinition(definition1);
        }
        catch (WSDLException wsdlexception)
        {
          wsdlexception.setLocation(XPathUtils.getXPathExprFromNode(element));
          throw wsdlexception;
        }
        catch (Throwable throwable)
        {
          throw new WSDLException(
            "OTHER_ERROR",
            "Unable to resolve imported document at '" + s1 + "'.",
            throwable);
        }
    }
    for (Element element1 = DOMUtils.getFirstChildElement(element);
      element1 != null;
      element1 = DOMUtils.getNextSiblingElement(element1))
      if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, element1))
        import1.setDocumentationElement(element1);
      else
        DOMUtils.throwWSDLException(element1);

    return import1;

View Full Code Here

        if (processImports) {
            // first we have to process the imports and change the
            // schema locations suite for the registry
            Iterator iter = wsdlDefinition.getImports().values().iterator();
            Vector values;
            Import wsdlImport;
            // add this to visited list to stop recursion
            visitedWSDLs.add(wsdlDefinition.getDocumentBaseURI());
            for (; iter.hasNext();) {
                values = (Vector)iter.next();
                for (Object value : values) {
                    wsdlImport = (Import)value;
                    // process the types recuresiveilt
                    Definition innerDefinition = wsdlImport.getDefinition();
                    if (!visitedWSDLs.contains(innerDefinition.getDocumentBaseURI())) {
                        // we have not process this wsdl file earlier
                        saveWSDLFileToRegistry(registry, innerDefinition, processedWSDLMap,
                                               visitedWSDLs, registryBasePath, processImports,
                                               null ,false);
                    }
                    // set the import location according to the new location
                    wsdlImport.setLocationURI((String)processedWSDLMap.get(
                            innerDefinition.getDocumentBaseURI()));
                    // add this wsdl as an association
                    String innerImportedResourceName =
                            (String)processedWSDLMap.get(innerDefinition.getDocumentBaseURI());
                    String innerWsdlPath = getWSDLPath(registryBasePath, innerImportedResourceName);
View Full Code Here

    EntryContext entryContext)
    throws WSIException
  {
    result = AssertionResult.RESULT_FAILED;

    Import im = (Import) entryContext.getEntry().getEntryDetail();
    // suppose that if location is invalid, the definition equals to null
    if (im.getLocationURI() == null || im.getLocationURI() == "")
      errors.add(im.getNamespaceURI(), im.getLocationURI());

    if (!errors.isEmpty())
    {
      result = AssertionResult.RESULT_FAILED;
      failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
View Full Code Here

      while(filesIter.hasNext())
      {
        WSDLDocument doc = (WSDLDocument)filesIter.next();
       
        DefinitionImpl def = (DefinitionImpl)doc.getDefinition();
        Import impElem = imp.getImport();
        if(impElem != null)
        {
          def.addImport(impElem);
          if(!imp.isWSDLFileImport())
          {
View Full Code Here

TOP

Related Classes of javax.wsdl.Import

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.