use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class AegisTest method testAegisReconfigureDatabinding.
@Test
public void testAegisReconfigureDatabinding() throws Exception {
final String sei = org.apache.cxf.tools.fortest.aegis2ws.TestAegisSEI.class.getName();
File wsdlFile = new File(folder.getRoot(), "aegis.wsdl");
String[] args = new String[] { "-wsdl", "-o", wsdlFile.toString(), "-beans", new File(getClass().getResource("/revisedAegisDefaultBeans.xml").toURI()).toString(), "-verbose", "-s", folder.getRoot().toString(), "-frontend", "jaxws", "-databinding", "aegis", "-client", "-server", sei };
JavaToWS.main(args);
assertTrue("wsdl is not generated " + getStdErr(), wsdlFile.exists());
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
Definition def = reader.readWSDL(wsdlFile.toURI().toURL().toString());
Document wsdl = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
assertValid("//xsd:element[@type='ns0:Something']", wsdl);
XPathUtils xpu = new XPathUtils(getNSMap());
String s = (String) xpu.getValue("//xsd:complexType[@name='takeSomething']/" + "xsd:sequence/xsd:element[@name='arg0']/@minOccurs", wsdl, XPathConstants.STRING);
assertEquals("50", s);
assertFalse(xpu.isExist("//xsd:complexType[@name='Something']/xsd:sequence/" + "xsd:element[@name='singular']/@minOccurs", wsdl, XPathConstants.NODE));
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class JAXWSDefinitionBuilder method buildCustomizedDefinition.
private Definition buildCustomizedDefinition() throws Exception {
Map<String, Element> eleMap = cusParser.getCustomizedWSDLElements();
String wsdlUrl = URIParserUtil.getAbsoluteURI((String) context.get(ToolConstants.CFG_WSDLURL));
CustomizedWSDLLocator wsdlLocator = new CustomizedWSDLLocator(wsdlUrl, eleMap);
wsdlLocator.setCatalogResolver(OASISCatalogManager.getCatalogManager(bus));
WSDLManager mgr = bus.getExtension(WSDLManager.class);
WSDLReader reader = mgr.getWSDLFactory().newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
reader.setExtensionRegistry(mgr.getExtensionRegistry());
Element el = eleMap.get(wsdlLocator.getBaseURI());
if (el == null) {
el = (Element) cusParser.getWSDLNode();
}
return reader.readWSDL(wsdlLocator, el);
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class OASISCatalogTest method testWSDLLocatorWithDefaultCatalog.
@Test
public void testWSDLLocatorWithDefaultCatalog() throws Exception {
URL wsdl = getClass().getResource("/wsdl/catalog/hello_world_services.wsdl");
assertNotNull(wsdl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
CatalogWSDLLocator wsdlLocator = new CatalogWSDLLocator(wsdl.toString(), OASISCatalogManager.getCatalogManager(null));
wsdlReader.setFeature("javax.wsdl.verbose", false);
wsdlReader.readWSDL(wsdlLocator);
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class OASISCatalogTest method testWSDLLocatorWithoutCatalog.
@Test
public void testWSDLLocatorWithoutCatalog() throws Exception {
URL wsdl = getClass().getResource("/wsdl/catalog/hello_world_services.wsdl");
assertNotNull(wsdl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
OASISCatalogManager catalog = new OASISCatalogManager();
CatalogWSDLLocator wsdlLocator = new CatalogWSDLLocator(wsdl.toString(), catalog);
try {
wsdlReader.readWSDL(wsdlLocator);
fail("Test did not fail as expected");
} catch (WSDLException e) {
// ignore
}
}
use of javax.wsdl.xml.WSDLReader in project tesb-studio-se by Talend.
the class WSDLUtils method getDefinition.
// public static Definition getDefinition(String pathToWsdl) throws CoreException {
// try {
// WSDLFactory wsdlFactory = WSDLFactory.newInstance();
// WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
//
// newWSDLReader.setExtensionRegistry(wsdlFactory.newPopulatedExtensionRegistry());
// newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
// return newWSDLReader.readWSDL(pathToWsdl);
// } catch (WSDLException e) {
// throw new CoreException(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e));
// }
// }
public static Definition getDefinition(IFile pathToWsdl) throws CoreException {
try {
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
newWSDLReader.setExtensionRegistry(wsdlFactory.newPopulatedExtensionRegistry());
newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
return newWSDLReader.readWSDL(pathToWsdl.getLocationURI().toString());
} catch (WSDLException e) {
throw getCoreException(null, e);
}
}
Aggregations