use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method testGetSwaggerModelForWSDLsWithCompositeBindings.
@Test
public void testGetSwaggerModelForWSDLsWithCompositeBindings() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/wsdl-with-composite-bindings/sampleservice.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
Set<WSDLSOAPOperation> operations = processor.getWsdlInfo().getSoapBindingOperations();
Assert.assertNotNull(operations);
Map<String, ModelImpl> parameterModelMap = processor.getWsdlInfo().getParameterModelMap();
Assert.assertNotNull(parameterModelMap);
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method testGetWsdlDefinition.
@Test
public void testGetWsdlDefinition() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/phoneverify.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = new WSDL11SOAPOperationExtractor(wsdlReader);
Assert.assertTrue("WSDL definition parsing failed", processor.init(wsdlContent));
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class WSDLSOAPOperationExtractorImplTestCase method testGetSwaggerModelForSimpleType.
@Test
public void testGetSwaggerModelForSimpleType() throws Exception {
APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/sample-service.wsdl").toExternalForm());
byte[] wsdlContent = wsdlReader.getWSDL();
WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
Map<String, ModelImpl> parameterModelMap = processor.getWsdlInfo().getParameterModelMap();
Assert.assertNotNull(parameterModelMap);
// get simple type
Assert.assertNotNull(parameterModelMap.get("Condition"));
Assert.assertEquals("string", parameterModelMap.get("Condition").getType());
// get simple type inside complex type
Assert.assertNotNull(parameterModelMap.get("ItemSearchRequest").getProperties().get("Availability"));
Assert.assertEquals("string", parameterModelMap.get("ItemSearchRequest").getProperties().get("Availability").getType());
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class SOAPOperationBindingUtils method getSoapOperationMapping.
/**
* Gets soap operations to rest resources mapping for a wsdl archive path
*
* @param path Path of the extracted WSDL archive
* @return swagger json string with the soap operation mapping
* @throws APIManagementException if an error occurs when generating swagger
*/
public static String getSoapOperationMapping(String path) throws APIManagementException {
APIMWSDLReader wsdlReader = new APIMWSDLReader(path);
WSDL11SOAPOperationExtractor processor = APIMWSDLReader.getWSDLSOAPOperationExtractor(path, wsdlReader);
WSDLInfo wsdlInfo = processor.getWsdlInfo();
return getGeneratedSwaggerFromWSDL(wsdlInfo);
}
use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.
the class SOAPOperationBindingUtils method getSoapOperationMappingForUrl.
/**
* Gets soap operations to rest resources mapping for a WSDL url
*
* @param url WSDL URL
* @return swagger json string with the soap operation mapping
* @throws APIManagementException if an error occurs when generating swagger
*/
public static String getSoapOperationMappingForUrl(String url) throws APIManagementException {
URL wsdlUrl = APIMWSDLReader.getURL(url);
WSDL11SOAPOperationExtractor processor = APIMWSDLReader.getWSDLSOAPOperationExtractorForUrl(wsdlUrl);
WSDLInfo wsdlInfo = processor.getWsdlInfo();
return getGeneratedSwaggerFromWSDL(wsdlInfo);
}
Aggregations