ReadWSDL { public Definition readWSDL(String fileName) throws WSDLException { Definition wsdlDefinition = null; WSDLFactory factory = WSDLFactoryImpl.newInstance(); WSDLReader reader = factory.newWSDLReader(); try { File f = new File(fileName); URL url = null; if (f.exists()) { log.info(fileName + " as a local file doesn't exist."); url = f.toURI().toURL(); } else { url = ClassUtil.getResource(fileName, this.getClass()); } if (url==null){ log.info(fileName + " as a class path resource doesn't exist."); throw new WSDLException("null input", fileName); } URI uri = url.toURI(); WSDLLocator locator = new WSDLLocatorImpl(uri); wsdlDefinition = reader.readWSDL(locator); } catch (URISyntaxException e) { log.error(e.getMessage(), e); } catch (MalformedURLException ex) { log.error(ex.getMessage(), ex); } return wsdlDefinition; }  Definition readWSDL(String fileName); Definition readWSDL(URL wsdlUrl, String username, String password); Definition readWSDL(URL wsdlUrl); boolean isIgnoreSSLErrors(); void setIgnoreSSLErrors(boolean IgnoreSSLErrors);  }
@Test public void readFromFile() throws WSDLException, URISyntaxException, Exception { ReadWSDL readWSDL = new ReadWSDL(); Definition definition = readWSDL.readWSDL("wsdl/HelloWorld.wsdl"); Assert.assertNotNull(definition); }
@Test public void readFromURL() throws MalformedURLException, Exception { boolean b = IsReachable("http: if (!b) { System.out.println("Skipping test for a remote WSDL due to connectivity problems"); } org.junit.Assume.assumeTrue(b); ReadWSDL readWSDL = new ReadWSDL(); Definition definition = null; try { definition = readWSDL.readWSDL(new URL("http: Assert.assertNotNull(definition); } catch (UnknownHostException ex) { } }
@Test public void readFromJar() throws WSDLException, URISyntaxException, Exception { ReadWSDL readWSDL = new ReadWSDL(); Definition definition = readWSDL.readWSDL("uddi_v3_service.wsdl"); Assert.assertNotNull(definition); }