use of javax.wsdl.WSDLException in project iaf by ibissource.
the class SchemaLocation method setWsdl.
@IbisDoc({ "the wsdl to read the xsd's from", " " })
public void setWsdl(String wsdl) throws ConfigurationException {
this.wsdl = wsdl;
WSDLReader reader = FACTORY.newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
reader.setFeature("javax.wsdl.importDocuments", true);
ClassLoaderWSDLLocator wsdlLocator = new ClassLoaderWSDLLocator(this, wsdl);
URL url = wsdlLocator.getUrl();
if (wsdlLocator.getUrl() == null) {
throw new ConfigurationException("Could not find WSDL: " + wsdl);
}
try {
definition = reader.readWSDL(wsdlLocator);
} catch (WSDLException e) {
throw new ConfigurationException("WSDLException reading WSDL or import from url: " + url, e);
}
if (wsdlLocator.getIOException() != null) {
throw new ConfigurationException("IOException reading WSDL or import from url: " + url, wsdlLocator.getIOException());
}
}
use of javax.wsdl.WSDLException in project Activiti by Activiti.
the class WSDLImporter method importFrom.
public void importFrom(String url) {
this.wsServices.clear();
this.wsOperations.clear();
this.structures.clear();
this.wsdlLocation = url;
try {
Definition definition = this.parseWSDLDefinition();
this.importServicesAndOperations(definition);
this.importTypes(definition.getTypes());
} catch (WSDLException e) {
throw new ActivitiException(e.getMessage(), e);
}
}
use of javax.wsdl.WSDLException in project carbon-apimgt by wso2.
the class WSDL11ProcessorImpl method getWSDLByteArrayOutputStream.
/**
* Retrieves a {@link ByteArrayOutputStream} for provided {@link Definition}.
*
* @param definition WSDL Definition
* @return A {@link ByteArrayOutputStream} for provided {@link Definition}
* @throws APIMgtWSDLException If an error occurs while creating {@link ByteArrayOutputStream}
*/
private ByteArrayOutputStream getWSDLByteArrayOutputStream(Definition definition) throws APIMgtWSDLException {
WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
writer.writeWSDL(definition, byteArrayOutputStream);
} catch (WSDLException e) {
throw new APIMgtWSDLException("Error while stringifying WSDL definition", e, ExceptionCodes.INTERNAL_WSDL_EXCEPTION);
}
return byteArrayOutputStream;
}
use of javax.wsdl.WSDLException in project carbon-apimgt by wso2.
the class WSDL11ProcessorImpl method getUpdatedWSDLPath.
/**
* Updates the endpoints of all the WSDL files in the path based on the provided API (context) and Label (host).
*
* @param api Provided API object
* @param label Provided label object
* @return Updated WSDL file path
* @throws APIMgtWSDLException Error while updating WSDL files
*/
@Override
public String getUpdatedWSDLPath(API api, Label label) throws APIMgtWSDLException {
if (label != null) {
for (Map.Entry<String, Definition> entry : pathToDefinitionMap.entrySet()) {
Definition definition = entry.getValue();
if (log.isDebugEnabled()) {
log.debug("Updating endpoints of WSDL: " + entry.getKey());
}
updateEndpoints(label.getAccessUrls(), api, definition);
if (log.isDebugEnabled()) {
log.debug("Successfully updated endpoints of WSDL: " + entry.getKey());
}
try (FileOutputStream wsdlFileOutputStream = new FileOutputStream(new File(entry.getKey()))) {
WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter();
writer.writeWSDL(definition, wsdlFileOutputStream);
} catch (IOException | WSDLException e) {
throw new APIMgtWSDLException("Failed to create WSDL archive for API:" + api.getName() + ":" + api.getVersion() + " for label " + label.getName(), ExceptionCodes.ERROR_WHILE_CREATING_WSDL_ARCHIVE);
}
}
}
return wsdlArchiveExtractedPath;
}
use of javax.wsdl.WSDLException 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