use of com.ibm.wsdl.xml.WSDLReaderImpl in project carbon-apimgt by wso2.
the class APIMWSDLReader method updateWSDL.
/**
* Update WSDL 1.0 service definitions saved in registry
*
* @param wsdl byte array of registry content
* @param api API object
* @return the OMElemnt of the new WSDL content
* @throws APIManagementException
*/
public OMElement updateWSDL(byte[] wsdl, API api) throws APIManagementException {
try {
// Generate wsdl document from registry data
WSDLReader wsdlReader = getWsdlFactoryInstance().newWSDLReader();
// switch off the verbose mode
wsdlReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
wsdlReader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS, false);
if (wsdlReader instanceof WSDLReaderImpl) {
((WSDLReaderImpl) wsdlReader).setIgnoreSchemaContent(true);
}
Definition wsdlDefinition = wsdlReader.readWSDL(null, getSecuredParsedDocumentFromContent(wsdl));
// Update transports
setServiceDefinition(wsdlDefinition, api);
WSDLWriter writer = getWsdlFactoryInstance().newWSDLWriter();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
writer.writeWSDL(wsdlDefinition, byteArrayOutputStream);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
return APIUtil.buildOMElement(byteArrayInputStream);
} catch (Exception e) {
String msg = " Error occurs when updating WSDL ";
log.error(msg);
throw new APIManagementException(msg, e);
}
}
use of com.ibm.wsdl.xml.WSDLReaderImpl in project carbon-apimgt by wso2.
the class APIMWSDLReader method readWSDLFile.
/**
* Create the WSDL definition <javax.wsdl.Definition> from the baseURI of
* the WSDL
*
* @return {@link Definition} - WSDL4j definition constructed form the wsdl
* original baseuri
* @throws APIManagementException
* @throws WSDLException
*/
@Deprecated
private Definition readWSDLFile() throws APIManagementException, WSDLException {
WSDLReader reader = getWsdlFactoryInstance().newWSDLReader();
// switch off the verbose mode
reader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
reader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS, false);
if (reader instanceof WSDLReaderImpl) {
((WSDLReaderImpl) reader).setIgnoreSchemaContent(true);
}
if (log.isDebugEnabled()) {
log.debug("Reading the WSDL. Base uri is " + baseURI);
}
return reader.readWSDL(null, getSecuredParsedDocumentFromURL(baseURI));
}
use of com.ibm.wsdl.xml.WSDLReaderImpl in project carbon-apimgt by wso2.
the class APIMWSDLReader method getWSDLDefinitionFromByteContent.
/**
* Returns WSDL definition from a byte content of the WSDL
*
* @param wsdl byte content of the WSDL document
* @return {@link Definition} - WSDL4j definition constructed form the wsdl
* @throws APIManagementException
*/
public Definition getWSDLDefinitionFromByteContent(byte[] wsdl, boolean readDependencies) throws APIManagementException {
try {
WSDLReader wsdlReader = getWsdlFactoryInstance().newWSDLReader();
// switch off the verbose mode
wsdlReader.setFeature(JAVAX_WSDL_VERBOSE_MODE, false);
wsdlReader.setFeature(JAVAX_WSDL_IMPORT_DOCUMENTS, false);
if (!readDependencies) {
if (wsdlReader instanceof WSDLReaderImpl) {
((WSDLReaderImpl) wsdlReader).setIgnoreSchemaContent(true);
}
}
return wsdlReader.readWSDL(null, getSecuredParsedDocumentFromContent(wsdl));
} catch (Exception e) {
String msg = " Error occurs when updating WSDL ";
throw new APIManagementException(msg, e);
}
}
Aggregations