Search in sources :

Example 1 with ServiceConfigurationError

use of com.sun.xml.ws.util.ServiceConfigurationError in project metro-jax-ws by eclipse-ee4j.

the class EndpointFactory method getWSDLPort.

/**
 * Parses the primary WSDL and returns the {@link WSDLPort} for the given service and port names
 *
 * @param primaryWsdl Primary WSDL
 * @param metadata it may contain imported WSDL and schema documents
 * @param serviceName service name in wsdl
 * @param portName port name in WSDL
 * @param container container in which this service is running
 * @return non-null wsdl port object
 */
@NotNull
private static WSDLPort getWSDLPort(SDDocumentSource primaryWsdl, Collection<? extends SDDocumentSource> metadata, @NotNull QName serviceName, @NotNull QName portName, Container container, EntityResolver resolver) {
    URL wsdlUrl = primaryWsdl.getSystemId();
    try {
        // TODO: delegate to another entity resolver
        WSDLModel wsdlDoc = RuntimeWSDLParser.parse(new Parser(primaryWsdl), new EntityResolverImpl(metadata, resolver), false, container, ServiceFinder.find(WSDLParserExtension.class).toArray());
        if (wsdlDoc.getServices().size() == 0) {
            throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_NOSERVICE_IN_WSDLMODEL(wsdlUrl));
        }
        WSDLService wsdlService = wsdlDoc.getService(serviceName);
        if (wsdlService == null) {
            throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_INCORRECTSERVICE(serviceName, wsdlUrl));
        }
        WSDLPort wsdlPort = wsdlService.get(portName);
        if (wsdlPort == null) {
            throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_INCORRECTSERVICEPORT(serviceName, portName, wsdlUrl));
        }
        return wsdlPort;
    } catch (IOException | ServiceConfigurationError | SAXException e) {
        throw new ServerRtException("runtime.parser.wsdl", wsdlUrl, e);
    } catch (XMLStreamException e) {
        throw new ServerRtException("runtime.saxparser.exception", e.getMessage(), e.getLocation(), e);
    }
}
Also used : XMLStreamException(javax.xml.stream.XMLStreamException) WSDLModel(com.sun.xml.ws.api.model.wsdl.WSDLModel) ServiceConfigurationError(com.sun.xml.ws.util.ServiceConfigurationError) WSDLService(com.sun.xml.ws.api.model.wsdl.WSDLService) IOException(java.io.IOException) URL(java.net.URL) Parser(com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver.Parser) RuntimeWSDLParser(com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser) WSDLPort(com.sun.xml.ws.api.model.wsdl.WSDLPort) SAXException(org.xml.sax.SAXException) NotNull(com.sun.istack.NotNull)

Aggregations

NotNull (com.sun.istack.NotNull)1 WSDLModel (com.sun.xml.ws.api.model.wsdl.WSDLModel)1 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)1 WSDLService (com.sun.xml.ws.api.model.wsdl.WSDLService)1 Parser (com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver.Parser)1 ServiceConfigurationError (com.sun.xml.ws.util.ServiceConfigurationError)1 RuntimeWSDLParser (com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser)1 IOException (java.io.IOException)1 URL (java.net.URL)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 SAXException (org.xml.sax.SAXException)1