use of org.wso2.carbon.apimgt.core.api.WSDLProcessor in project carbon-apimgt by wso2.
the class APIPublisherImpl method updateAPIWSDL.
@Override
public String updateAPIWSDL(String apiId, InputStream inputStream) throws APIMgtDAOException, APIMgtWSDLException {
byte[] wsdlContent;
try {
wsdlContent = IOUtils.toByteArray(inputStream);
WSDLProcessor processor = WSDLProcessFactory.getInstance().getWSDLProcessor(wsdlContent);
if (!processor.canProcess()) {
throw new APIMgtWSDLException("Unable to process WSDL by the processor " + processor.getClass().getName(), ExceptionCodes.CANNOT_PROCESS_WSDL_CONTENT);
}
if (log.isDebugEnabled()) {
log.debug("Successfully validated the content of WSDL. API uuid: " + apiId);
}
getApiDAO().addOrUpdateWSDL(apiId, wsdlContent, getUsername());
if (log.isDebugEnabled()) {
log.debug("Successfully added WSDL to the DB. API uuid: " + apiId);
}
return new String(wsdlContent, APIMgtConstants.ENCODING_UTF_8);
} catch (IOException e) {
throw new APIMgtWSDLException("Error while updating WSDL of API " + apiId, e, ExceptionCodes.INTERNAL_WSDL_EXCEPTION);
}
}
Aggregations