Search in sources :

Example 1 with WsdlResolver

use of org.apache.openejb.core.webservices.WsdlResolver in project tomee by apache.

the class WsDeployer method readWsdl.

// don't put it in ReadDescriptors to respect classloader dependencies (wsdl4j is optional)
public static Definition readWsdl(final URL url) throws OpenEJBException {
    final Definition definition;
    try {
        final WSDLFactory factory = WSDLFactory.newInstance();
        final WSDLReader reader = factory.newWSDLReader();
        reader.setFeature("javax.wsdl.verbose", true);
        reader.setFeature("javax.wsdl.importDocuments", true);
        final WsdlResolver wsdlResolver = new WsdlResolver(new URL(url, ".").toExternalForm(), new InputSource(IO.read(url)));
        definition = reader.readWSDL(wsdlResolver);
    } catch (final IOException e) {
        throw new OpenEJBException("Cannot read the wsdl file: " + url.toExternalForm(), e);
    } catch (final Exception e) {
        throw new OpenEJBException("Encountered unknown error parsing the wsdl file: " + url.toExternalForm(), e);
    }
    return definition;
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) InputSource(org.xml.sax.InputSource) WSDLFactory(javax.wsdl.factory.WSDLFactory) WsdlResolver(org.apache.openejb.core.webservices.WsdlResolver) Definition(javax.wsdl.Definition) IOException(java.io.IOException) WSDLReader(javax.wsdl.xml.WSDLReader) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) OpenEJBException(org.apache.openejb.OpenEJBException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Definition (javax.wsdl.Definition)1 WSDLFactory (javax.wsdl.factory.WSDLFactory)1 WSDLReader (javax.wsdl.xml.WSDLReader)1 OpenEJBException (org.apache.openejb.OpenEJBException)1 WsdlResolver (org.apache.openejb.core.webservices.WsdlResolver)1 InputSource (org.xml.sax.InputSource)1