Package org.apache.woden

Examples of org.apache.woden.WSDLReader


        setPolicyRegistryFromService(axisService);
    }

    public WSDL20ToAxisServiceBuilder(String wsdlUri,
                                      String name, String interfaceNamethrows Exception  {
        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
        DescriptionElement descriptionElement = wsdlReader.readWSDL(wsdlUri);
        savedTargetNamespace = descriptionElement.getTargetNamespace()
                .toString();
        namespacemap = descriptionElement.getNamespaces();
        this.description = descriptionElement.toComponent();
        this.serviceName = null;
View Full Code Here


                            .newInstance();
                    documentBuilderFactory.setNamespaceAware(true);
                    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                    Document document = documentBuilder.parse(in);

                    WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
                    WSDLSource wsdlSource = reader.createWSDLSource();
                    wsdlSource.setSource(document.getDocumentElement());
                    // wsdlSource.setBaseURI(new URI(getBaseUri()));
                    descriptionElement = reader.readWSDL(wsdlSource);
                } else {
                    throw new AxisFault("No resources found to read the wsdl");
                }

                savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
View Full Code Here

    }

    private DescriptionElement readInTheWSDLFile(String wsdlURI)
            throws WSDLException {

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

        // TODO : I can not find a constant for this feature in WSDLReader
        // reader.setFeature("javax.wsdl.importDocuments", false);

//        reader.setFeature(WSDLReader.FEATURE_VERBOSE, false);
        return reader.readWSDL(wsdlURI);
    }
View Full Code Here

                if (logger.isDebugEnabled()) {
                    logger.debug("Endpoint " + serviceEndpoint + " has a non WSDL2 service description");
                }
                return;
            }
            WSDLReader reader = new DOMWSDLReader();
            DOMWSDLSource source = (DOMWSDLSource) reader.createWSDLSource();
            source.setSource(document);
            DescriptionElement descElement = reader.readWSDL(source);
            Description desc = descElement.toComponent();
            // Check if the wsdl is only a port type
            // In these cases, only the port type is used, as the service name and endpoint name
            // are provided on the jbi endpoint
            if (desc.getInterfaces().length == 1 && desc.getServices().length == 0) {
View Full Code Here

        }
        return readInTheWSDLFile(document);
    }

    private Description readInTheWSDLFile(Document document) throws WSDLException {
        WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
        if (customWSDLResolver != null) {
            reader.setURIResolver(customWSDLResolver);
        }
        // This turns on WSDL validation which is set off by default.
        reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
        WSDLSource wsdlSource = reader.createWSDLSource();
        wsdlSource.setSource(document.getDocumentElement());
        String uri = getBaseUri();
        if (uri != null && !"".equals(uri)) {
            try {
                wsdlSource.setBaseURI(new URI(uri));
            } catch (URISyntaxException e) {
                File f = new File(uri);
                if(f.exists()) {
                    wsdlSource.setBaseURI(f.toURI());
                } else {
                    log.error(e.toString(), e);
                }
            }
        }
        if (log.isDebugEnabled()) {
            log.debug("Reading 2.0 WSDL with wsdl uri = " + wsdlURI);
            log.debug("  the stack at this point is: " + stackToString());
        }
        return reader.readWSDL(wsdlSource);
    }
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("")) {
               logger.info("Using woden with implementation from " + implName);
               WSDLFactory factory = WSDLFactory.newInstance(implName);
               reader = factory.newWSDLReader();
           } else {
               logger.info("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) {
            logger.warn("warning: " + e.getMessage());
        }

        if (isVerbose()) {
            logger.info("File dir = " + dir.getAbsolutePath());

            Project project = getProject();
            File baseDir = project.getBaseDir();
            logger.info("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();
            logger.info("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

        setPolicyRegistryFromService(axisService);
    }

    public WSDL20ToAxisServiceBuilder(String wsdlUri,
                                      String name, String interfaceName) throws Exception {
        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();

        String fullPath = wsdlUri;
        if (!wsdlUri.startsWith("http://")) {
            File file = new File(wsdlUri);
            fullPath = file.getAbsolutePath();
        }
        Description description = wsdlReader.readWSDL(fullPath);

        DescriptionElement descriptionElement = description.toElement();
        savedTargetNamespace = descriptionElement.getTargetNamespace()
                .toString();
        namespacemap = descriptionElement.getNamespaces();
View Full Code Here

                            .newInstance();
                    documentBuilderFactory.setNamespaceAware(true);
                    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
                    Document document = documentBuilder.parse(in);

                    WSDLReader reader = DOMWSDLFactory.newInstance().newWSDLReader();
                    WSDLSource wsdlSource = reader.createWSDLSource();
                    wsdlSource.setSource(document.getDocumentElement());
                    wsdlSource.setBaseURI(new URI(getBaseUri()));
                    description = reader.readWSDL(wsdlSource);
                    descriptionElement = description.toElement();
                } else {
                    throw new AxisFault("No resources found to read the wsdl");
                }
View Full Code Here

    }

    private Description readInTheWSDLFile(String wsdlURI)
            throws WSDLException {

        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
        return reader.readWSDL(wsdlURI);
    }
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.