Package org.apache.woden

Examples of org.apache.woden.WSDLReader


            catalogURL);
        // simulate the standard compiler "-D" option ...
        fCatalogPropValue = System.setProperty(fCatalogProperty, catalogURL.toString());
       
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        ErrorHandler handler = new TestErrorHandler();
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
        reader.getErrorReporter().setErrorHandler(handler);
       
        URL wsdlURL = getClass().getClassLoader().getResource(fWsdlPath);
        assertNotNull("Failed to find the WSDL document on the classpath using the path: " + fWsdlPath + ".",
                wsdlURL);
       

    // set the resolver explicitly, using the root as a base URL
    // (SimpleURIResolver() default constructor is the default behaviour)
       
        // Base/root URL property no longer required in this test - now uses classpath
        //URL rootURL = getClass().getClassLoader().getResource(fResources);
        //assertNotNull("Failed to find the Base URL document on the classpath using the path: " + fResources + ".",
        //        wsdlURL);
        //System.setProperty(fCatalogBaseProperty, rootURL.toString());
    reader.setURIResolver(new SimpleURIResolver());
   
    Description descComp = reader.readWSDL(wsdlURL.toString());
        assertNotNull("The reader did not return a WSDL description.", descComp);
       
        fBindings = descComp.getBindings();
        fInterfaces = descComp.getInterfaces();
       
View Full Code Here


                // default cmext
                setCmext(CMEXT_DEFAULT);
            }
        }

        WSDLReader reader = null;

        // create a reader (with specified implementation if given).
        try {
           //If an implementation name is given use that to test against, else use the default one.
           if (implName != null && !implName.equals("")) {
               System.out.println("Using woden with implementation from " + implName);
               WSDLFactory factory = WSDLFactory.newInstance(implName);
               reader = factory.newWSDLReader();
           } else {
               System.out.println("Using default woden implementation.");
               WSDLFactory factory = WSDLFactory.newInstance();
               reader = factory.newWSDLReader();
           }

        } catch (WSDLException e) {

            // fail if unable to create a reader
            throw new BuildException(e);
        }

        // set the features but continue even if they are not supported yet
        try {
            // always enable WSDL 2.0 validation since this is a validation task
            reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);

            // enable verbose output
            reader.setFeature(WSDLReader.FEATURE_VERBOSE, isVerbose());

            // enable continue on error (opposite of fail on error)
            reader.setFeature(WSDLReader.FEATURE_CONTINUE_ON_ERROR,
                    !isFailOnError());
        } catch (IllegalArgumentException e) {
            System.out.println("warning: " + e.getMessage());
        }

        if (isVerbose()) {
            System.out.println("File dir = " + dir.getAbsolutePath());

            Project project = getProject();
            File baseDir = project.getBaseDir();
            System.out.println("File baseDir = " + baseDir.getAbsolutePath());
        }

        DirectoryScanner directoryScanner = getDirectoryScanner(dir);
        String[] files = directoryScanner.getIncludedFiles();

        reportWriter = Report.openReport(report);
        reader.getErrorReporter().setErrorHandler(reportWriter);
       
        // use the same reader for all the WSDL files
        for (int i = 0; i < files.length; i++) {

            File file = new File(dir, files[i]);

            // make a URL for the file
            String wsdlLoc = file.toURI().toString();
            System.out.println("validating " + wsdlLoc);

            reportWriter.beginWsdl(wsdlLoc);
            try {
                // <-- the Description component
                Description descComp = reader.readWSDL(wsdlLoc);

                if (isCm()) {
                    // write the Component Model interchange format output file
                    writeCm(descComp, files[i]);
                }
View Full Code Here

        reportWriter.beginWsdl(wsdlLoc);

        try {

            WSDLFactory factory = WSDLFactory.newInstance();
            WSDLReader reader = factory.newWSDLReader();

            // <-- enable WSDL 2.0 validation (optional)
            reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
           
            //Add errorHandler
            reader.getErrorReporter().setErrorHandler(reportWriter);
           
            // <-- the Description component
            Description descComp = reader.readWSDL(wsdlLoc);

            File xml = new File(wsdlCmLoc);
            FileOutputStream fos = new FileOutputStream(xml);
            PrintWriter out = new PrintWriter(fos);
            WsdlCm wsdlCm = new WsdlCm(out);
View Full Code Here

            catalogURL);
        // simulate the standard compiler "-D" option ...
        fCatalogPropValue = System.setProperty(fCatalogProperty, catalogURL.toString());
       
        WSDLFactory factory = OMWSDLFactory.newInstance("org.apache.woden.internal.OMWSDLFactory");
        WSDLReader reader = factory.newWSDLReader();
        ErrorHandler handler = new TestErrorHandler();
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
        reader.getErrorReporter().setErrorHandler(handler);
       
        URL wsdlURL = getClass().getClassLoader().getResource(fWsdlPath);
        assertNotNull("Failed to find the WSDL document on the classpath using the path: " + fWsdlPath + ".",
                wsdlURL);

    // set the resolver explicitly, using the root as a base URL
    // (SimpleURIResolver() default constructor is the default behaviour)

    reader.setURIResolver(new SimpleURIResolver());
   
        Description descComp = reader.readWSDL(wsdlURL.toString());
        assertNotNull("The reader did not return a WSDL description.", descComp);
       
        fBindings = descComp.getBindings();
        fInterfaces = descComp.getInterfaces();
       
View Full Code Here

          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instantiate the WSDLFactory object.");
      }
     
      WSDLReader reader = factory.newWSDLReader();
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
      reporter = reader.getErrorReporter();
        handler = new TestErrorHandler();
      reporter.setErrorHandler(handler);
    wodenContext = new WodenContextImpl(reporter, null);
  }
View Full Code Here

     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        ErrorHandler handler = new TestErrorHandler();
        //Don't set validation on, as the testcase WSDL is not intended to be a valid WSDL 2.0 doc.
        reader.getErrorReporter().setErrorHandler(handler);
       
        URL wsdlURL = getClass().getClassLoader().getResource(fWsdlPath);
        assertNotNull("Failed to find the WSDL document on the classpath using the path: " + fWsdlPath + ".",
                wsdlURL);
       
        Description descComp = reader.readWSDL(wsdlURL.toString());
        assertNotNull("The reader did not return a WSDL description.", descComp);
       
        Service service = descComp.getServices()[0];
        assertNotNull("The Description should contain 1 Service component.",
                service);
View Full Code Here

          factory = WSDLFactory.newInstance();
      } catch (WSDLException e) {
          fail("Can't instantiate the WSDLFactory object.");
      }
     
      WSDLReader reader = factory.newWSDLReader();
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
      reporter = reader.getErrorReporter();
        handler = new TestErrorHandler();
      reporter.setErrorHandler(handler);
    wodenContext = new WodenContextImpl(reporter, new SimpleURIResolver());
  }
View Full Code Here

    public void testNSUriIsNull() throws Exception {
        URL wsdlURL = getClass().getClassLoader().getResource("testcase/documentation/extension/resources/nonamespace.wsdl");
        assertNotNull("Failed to find nonamespace.wsdl on the classpath",wsdlURL);

        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        ErrorHandler handler = new TestErrorHandler();
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
        reader.getErrorReporter().setErrorHandler(handler);
        Description descComp = reader.readWSDL(wsdlURL.toString());
        assertNotNull("The reader did not return a WSDL description.", descComp);
        DescriptionElement desc = descComp.toElement();
       
        DocumentationElement doc = null;
        UnknownExtensionElement ee = null;
View Full Code Here

    }
   
    protected void setUp() throws Exception {
        super.setUp();
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        fExtReg = reader.getExtensionRegistry();
    }
View Full Code Here

        marshaler.setBinding(BindingFactory.createBinding(port));
    }
   
    protected void validateWsdl2(HttpSoapProviderMarshaler marshaler) throws
                                  org.apache.woden.WSDLException, IOException, DeploymentException {
        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descElement = reader.readWSDL(wsdl.getURL().toString());
        Description desc = descElement.toComponent();
        org.apache.woden.wsdl20.Service svc;
        if (getService() != null) {
            svc = desc.getService(getService());
            if (svc == null) {
View Full Code Here

TOP

Related Classes of org.apache.woden.WSDLReader

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.