Wsdl { public void init() throws IOException, XMLStreamException, ConfigurationException { inputXsds = new HashSet<XSD>(); outputXsds = new HashSet<XSD>(); xsds = new HashSet<XSD>(); rootXsds = new HashSet<XSD>(); Set<XSD> inputRootXsds = new HashSet<XSD>(); inputRootXsds.addAll(getXsds(inputValidator)); rootXsds.addAll(inputRootXsds); inputXsds.addAll(SchemaUtils.getXsdsRecursive(inputRootXsds)); xsds.addAll(inputXsds); if (outputValidator != null) { Set<XSD> outputRootXsds = new HashSet<XSD>(); outputRootXsds.addAll(getXsds(outputValidator)); rootXsds.addAll(outputRootXsds); outputXsds.addAll(SchemaUtils.getXsdsRecursive(outputRootXsds)); xsds.addAll(outputXsds); } prefixByXsd = new LinkedHashMap<XSD, String>(); namespaceByPrefix = new LinkedHashMap<String, String>(); int prefixCount = 1; xsdsGroupedByNamespace = SchemaUtils.getXsdsGroupedByNamespace(xsds, true); for (String namespace: xsdsGroupedByNamespace.keySet()) { if (!"http: for (XSD xsd: xsdsGroupedByNamespace.get(namespace)) { prefixByXsd.put(xsd, "ns" + prefixCount); } namespaceByPrefix.put("ns" + prefixCount, namespace); prefixCount++; } } for (XSD xsd : xsds) { if (StringUtils.isEmpty(xsd.getTargetNamespace()) && !xsd.isAddNamespaceToSchema()) { warn("XSD '" + xsd + "' doesn't have a targetNamespace and addNamespaceToSchema is false"); } } inputRoot = getRoot(inputValidator); inputHeaderElement = getHeaderElement(inputValidator, inputXsds); inputHeaderIsOptional = isHeaderOptional(inputValidator); inputBodyElement = getBodyElement(inputValidator, inputXsds, "inputValidator"); if (outputValidator != null) { outputRoot = getRoot(outputValidator); outputHeaderElement = getHeaderElement(outputValidator, outputXsds); outputHeaderIsOptional = isHeaderOptional(outputValidator); outputBodyElement = getBodyElement(outputValidator, outputXsds, "outputValidator"); } for (IListener listener : WsdlUtils.getListeners(pipeLine.getAdapter())) { if (listener instanceof WebServiceListener) { httpActive = true; } else if (listener instanceof JmsListener) { jmsActive = true; } else if (listener instanceof JavaListener) { JavaListener jl = (JavaListener) listener; if (jl.isHttpWsdl()) httpActive = true; } } } Wsdl(PipeLine pipeLine);  Wsdl(PipeLine pipeLine, String generationInfo); String getName(); String getFilename(); String getTargetNamespace(); String getDocumentation(); void setDocumentation(String documentation); boolean isIndent(); void setIndent(boolean indent); boolean isUseIncludes(); void setUseIncludes(boolean useIncludes); String getTargetNamespacePrefix(); void setTargetNamespacePrefix(String targetNamespacePrefix); void init(); Set<XSD> getXsds(IXmlValidator xmlValidator); void zip(OutputStream stream, String servletName); void wsdl(OutputStream out, String servlet); static final String WSDL_EXTENSION; }
@Test public void basic() throws XMLStreamException, IOException, ParserConfigurationException, SAXException, ConfigurationException, URISyntaxException, NamingException { PipeLine simple = mockPipeLine( getXmlValidatorInstance("a", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), getXmlValidatorInstance("b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), "urn:webservice1", "Test1"); Wsdl wsdl = new Wsdl(simple); wsdl.init(); test(wsdl, "WsdlTest/webservice1.test.wsdl"); }
@Test public void basicMixed() throws XMLStreamException, IOException, ParserConfigurationException, SAXException, ConfigurationException, URISyntaxException, NamingException { XmlValidator inputValidator=getXmlValidatorInstance("a", "b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"); IPipe outputValidator=inputValidator.getResponseValidator(); PipeLine simple = mockPipeLine(inputValidator, outputValidator, "urn:webservice1", "Test1"); Wsdl wsdl = new Wsdl(simple); wsdl.init(); test(wsdl, "WsdlTest/webservice1.test.wsdl"); }
@Test public void noroottag() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException { PipeLine simple = mockPipeLine( getXmlValidatorInstance(null, "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), getXmlValidatorInstance("b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"), "urn:webservice1", "TestRootTag"); Wsdl wsdl = new Wsdl(simple); wsdl.init(); test(wsdl, "WsdlTest/noroottag.test.wsdl"); }
@Test public void noroottagMixed() throws XMLStreamException, IOException, SAXException, ParserConfigurationException, URISyntaxException, ConfigurationException, NamingException { XmlValidator inputValidator=getXmlValidatorInstance(null, "b", "WsdlTest/test.xsd", "urn:webservice1 WsdlTest/test.xsd"); IPipe outputValidator=inputValidator.getResponseValidator(); PipeLine simple = mockPipeLine(inputValidator, outputValidator, "urn:webservice1", "TestRootTag"); Wsdl wsdl = new Wsdl(simple); wsdl.init(); test(wsdl, "WsdlTest/noroottag.test.wsdl"); }