use of javax.wsdl.xml.WSDLReader in project tdi-studio-se by Talend.
the class ServiceDiscoveryHelper method init.
/**
* Read the wsdl and schema
*
* @throws javax.wsdl.WSDLException
*/
private void init() throws WSDLException, IOException {
wsdlFactory = WSDLFactory.newInstance();
// wsdlFactory.
WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
newWSDLReader.setExtensionRegistry(wsdlFactory.newPopulatedExtensionRegistry());
// newWSDLReader.getExtensionRegistry()
newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
if (configuration == null) {
definition = newWSDLReader.readWSDL(wsdlUri);
} else {
definition = newWSDLReader.readWSDL(configuration.createWSDLLocator(wsdlUri));
}
definitions = findWsdlImport(definition, null, null, null);
}
use of javax.wsdl.xml.WSDLReader in project tdi-studio-se by Talend.
the class AllTypeDialog method initSimpleType.
private void initSimpleType() throws WSDLException, URISyntaxException {
String url = URLValue;
XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
URI wsdlURI = new URI(url);
Definition definition = newWSDLReader.readWSDL(url);
java.util.List<ExtensibilityElement> extensibilityElements = definition.getTypes().getExtensibilityElements();
String tmpTNName = "";
int tmpCount = 0;
for (ExtensibilityElement el : extensibilityElements) {
if (el instanceof Schema) {
Schema schema = (Schema) el;
// for bug 8674
// set base uri for relative path in schemaLocation.
schemaCollection.setBaseUri(schema.getDocumentBaseURI());
if (schema.getElement().getAttributeNode("targetNamespace") == null) {
tmpTNName = schema.getDocumentBaseURI() + "#type" + tmpCount;
schemaCollection.read(schema.getElement(), tmpTNName);
tmpCount++;
} else {
schemaCollection.read(schema.getElement());
}
}
}
Map namespaces = definition.getNamespaces();
// System.out.println(namespaces);
XmlSchema[] schemas = schemaCollection.getXmlSchemas();
java.util.List<String> labelList = new ArrayList<String>();
for (int i = 0; i < schemas.length; i++) {
XmlSchema schema = schemas[i];
XmlSchemaObjectTable types = schema.getSchemaTypes();
Iterator it = types.getValues();
while (it.hasNext()) {
XmlSchemaType type = (XmlSchemaType) it.next();
if (type instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType t = (XmlSchemaSimpleType) type;
String label = "simpletype:" + t.getName();
if (!labelList.contains(label)) {
labelList.add(label);
labelAndNameSpaceMap.put(label, t.getQName().toString());
}
}
}
}
allXMLSimpleTypeName = new String[labelList.size()];
for (int i = 0; i < labelList.size(); i++) {
allXMLSimpleTypeName[i] = labelList.get(i);
}
}
use of javax.wsdl.xml.WSDLReader in project Lucee by lucee.
the class JaxWSClient method loadWSDL.
private static Definition loadWSDL(URL url) throws WSDLException {
WSDLFactory factory = WSDLFactory.newInstance();
// create an object to read the WSDL file
WSDLReader reader = factory.newWSDLReader();
// pass the URL to the reader for parsing and get back a WSDL definiton
return reader.readWSDL(url.toExternalForm());
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class WSDLHelper method getDefinition.
public Definition getDefinition(File wsdlFile) throws Exception {
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader reader = wsdlFactory.newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
return reader.readWSDL(wsdlFile.toURI().toURL().toString());
}
use of javax.wsdl.xml.WSDLReader in project carbon-apimgt by wso2.
the class WSDL11ProcessorImpl method initPath.
/**
* {@inheritDoc}
* Will return true if all the provided WSDL files in the initialized path is of 1.1 and can be successfully
* parsed by WSDL4J.
*/
@Override
public boolean initPath(String path) throws APIMgtWSDLException {
pathToDefinitionMap = new HashMap<>();
wsdlArchiveExtractedPath = path;
WSDLReader wsdlReader = getWsdlFactoryInstance().newWSDLReader();
// switch off the verbose mode
wsdlReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
wsdlReader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS, false);
try {
File folderToImport = new File(path);
Collection<File> foundWSDLFiles = APIFileUtils.searchFilesWithMatchingExtension(folderToImport, "wsdl");
if (log.isDebugEnabled()) {
log.debug("Found " + foundWSDLFiles.size() + " WSDL file(s) in path " + path);
}
for (File file : foundWSDLFiles) {
String absWSDLPath = file.getAbsolutePath();
if (log.isDebugEnabled()) {
log.debug("Processing WSDL file: " + absWSDLPath);
}
Definition definition = wsdlReader.readWSDL(null, absWSDLPath);
pathToDefinitionMap.put(absWSDLPath, definition);
}
if (foundWSDLFiles.size() > 0) {
canProcess = true;
}
if (log.isDebugEnabled()) {
log.debug("Successfully processed all WSDL files in path " + path);
}
} catch (WSDLException e) {
// This implementation class cannot process the WSDL.
log.debug("Cannot process the WSDL by " + this.getClass().getName(), e);
canProcess = false;
}
return canProcess;
}
Aggregations