Search in sources :

Example 1 with WSDLDocument

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

the class WSDLParserTest method testParsePolicy15.

public void testParsePolicy15() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("policy15.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 2 with WSDLDocument

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

the class WSDLParserTest method testParseEmpty.

public void testParseEmpty() throws Exception {
    final ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter();
    final InputSource source = getResourceSource("empty.wsdl");
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
    final WSDLDocument wsdl = instance.parse();
    assertNull(wsdl);
    assertTrue(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 3 with WSDLDocument

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

the class WSDLParserTest method testParsePolicy12.

public void testParsePolicy12() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("policy12.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 4 with WSDLDocument

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

the class WSDLParserTest method testParseSimpleSystemIdNull.

public void testParseSimpleSystemIdNull() throws Exception {
    final ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter();
    final InputSource source = getResourceSource("simple.wsdl");
    source.setSystemId(null);
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    try {
        final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
        final WSDLDocument wsdl = instance.parse();
        fail("Expected IllegalArgumentException, instead got " + wsdl);
    } catch (IllegalArgumentException e) {
    // expected
    }
}
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 5 with WSDLDocument

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

the class WSDLParser method buildWSDLDocument.

private WSDLDocument buildWSDLDocument() {
    /*
          Currently we are working off first WSDL document
          TODO: add support of creating WSDLDocument from fromjava.collection of WSDL documents
         */
    String location = forest.getRootWSDL();
    // It means that WSDL is not found, an error might have been reported, lets try to recover
    if (location == null)
        return null;
    Document root = forest.get(location);
    if (root == null)
        return null;
    WSDLDocument document = new WSDLDocument(forest, errReceiver);
    document.setSystemId(location);
    TWSDLParserContextImpl context = new TWSDLParserContextImpl(forest, document, listeners, errReceiver);
    Definitions definitions = parseDefinitions(context, root);
    document.setDefinitions(definitions);
    return document;
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) TWSDLParserContextImpl(com.sun.tools.ws.wsdl.framework.TWSDLParserContextImpl) Definitions(com.sun.tools.ws.wsdl.document.Definitions) 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