Search in sources :

Example 6 with WSDLDocument

use of com.sun.tools.ws.wsdl.document.WSDLDocument in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParseUsingPolicyRequired.

public void testParseUsingPolicyRequired() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("usingpolicy-required.wsdl");
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
    final WSDLDocument wsdl = instance.parse();
    assertNotNull(wsdl);
    assertFalse(errorReceiver.hadError());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 7 with WSDLDocument

use of com.sun.tools.ws.wsdl.document.WSDLDocument in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParseSimple.

public void testParseSimple() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("simple.wsdl");
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
    final WSDLDocument wsdl = instance.parse();
    assertNotNull(wsdl);
    assertFalse(errorReceiver.hadError());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 8 with WSDLDocument

use of com.sun.tools.ws.wsdl.document.WSDLDocument in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParseUsingPolicy.

public void testParseUsingPolicy() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("usingpolicy.wsdl");
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
    final WSDLDocument wsdl = instance.parse();
    assertNotNull(wsdl);
    assertFalse(errorReceiver.hadError());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 9 with WSDLDocument

use of com.sun.tools.ws.wsdl.document.WSDLDocument in project metro-jax-ws by eclipse-ee4j.

the class WSDLParser method parse.

public WSDLDocument parse() throws SAXException, IOException {
    // parse external binding files
    for (InputSource value : options.getWSDLBindings()) {
        errReceiver.pollAbort();
        Document root = forest.parse(value, false);
        // error must have been reported
        if (root == null)
            continue;
        Element binding = root.getDocumentElement();
        if (!Internalizer.fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) || !binding.getLocalName().equals("bindings")) {
            errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE(binding.getNamespaceURI(), binding.getLocalName()));
            continue;
        }
        NodeList nl = binding.getElementsByTagNameNS("https://jakarta.ee/xml/ns/jakartaee", "handler-chains");
        for (int i = 0; i < nl.getLength(); i++) {
            options.addHandlerChainConfiguration((Element) nl.item(i));
        }
        // fallback to pre-jakarta version
        nl = binding.getElementsByTagNameNS("http://java.sun.com/xml/ns/javaee", "handler-chains");
        for (int i = 0; i < nl.getLength(); i++) {
            options.addHandlerChainConfiguration((Element) nl.item(i));
        }
    }
    return buildWSDLDocument();
}
Also used : InputSource(org.xml.sax.InputSource) Element(org.w3c.dom.Element) NodeList(org.w3c.dom.NodeList) Document(org.w3c.dom.Document) WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument)

Aggregations

WSDLDocument (com.sun.tools.ws.wsdl.document.WSDLDocument)9 InputSource (org.xml.sax.InputSource)8 ErrorReceiverFilter (com.sun.tools.ws.wscompile.ErrorReceiverFilter)7 WsimportOptions (com.sun.tools.ws.wscompile.WsimportOptions)7 WSDLParser (com.sun.tools.ws.wsdl.parser.WSDLParser)7 Document (org.w3c.dom.Document)2 Definitions (com.sun.tools.ws.wsdl.document.Definitions)1 TWSDLParserContextImpl (com.sun.tools.ws.wsdl.framework.TWSDLParserContextImpl)1 Element (org.w3c.dom.Element)1 NodeList (org.w3c.dom.NodeList)1