use of org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader in project carbon-apimgt by wso2.
the class APIMWSDLReader method getWSDLProcessor.
/**
* Returns the appropriate WSDL 1.1/WSDL 2.0 based on the file path {@code wsdlPath}.
*
* @param wsdlPath File path containing WSDL files and dependant files
* @return WSDL 1.1/2.0 processor for the provided content
* @throws APIManagementException If an error occurs while determining the processor
*/
public static WSDLProcessor getWSDLProcessor(String wsdlPath) throws APIManagementException {
WSDLProcessor wsdl11Processor = new WSDL11ProcessorImpl();
WSDLProcessor wsdl20Processor = new WSDL20ProcessorImpl();
byte[] wsdlContent;
APIMWSDLReader wsdlReader;
if (wsdlPath.endsWith(".wsdl") || wsdlPath.endsWith("?wsdl")) {
wsdlReader = new APIMWSDLReader(wsdlPath);
wsdlContent = wsdlReader.getWSDL();
return getWSDLProcessor(wsdlContent);
} else {
try {
if (wsdl11Processor.canProcess(wsdlPath)) {
wsdl11Processor.initPath(wsdlPath);
return wsdl11Processor;
} else if (wsdl20Processor.canProcess(wsdlPath)) {
wsdl20Processor.initPath(wsdlPath);
return wsdl20Processor;
} else {
// no processors found if this line reaches
throw new APIManagementException("No WSDL processor found to process WSDL content.", ExceptionCodes.CONTENT_NOT_RECOGNIZED_AS_WSDL);
}
} catch (APIMgtWSDLException e) {
throw new APIManagementException("Error while instantiating wsdl processor class", e);
}
}
}
use of org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader in project carbon-apimgt by wso2.
the class APIMWSDLReader method getWSDLSOAPOperationExtractor.
/**
* Returns a WSDL11SOAPOperationExtractor for the url {@code url}. Only WSDL 1.1 is supported.
*
* @param wsdlPath File path containing WSDL files and dependant files
* @return WSDL11SOAPOperationExtractor for the provided URL
* @throws APIManagementException If an error occurs while determining the processor
*/
public static WSDL11SOAPOperationExtractor getWSDLSOAPOperationExtractor(String wsdlPath, APIMWSDLReader wsdlReader) throws APIManagementException {
WSDL11SOAPOperationExtractor processor = new WSDL11SOAPOperationExtractor();
processor.loadXSDs(wsdlReader, wsdlPath);
processor.initPath(wsdlPath);
return processor;
}
Aggregations