Search in sources :

Example 1 with WSDL11SOAPOperationExtractor

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 byte content
 *
 * @param wsdlContent WSDL byte content
 * @return swagger json string with the soap operation mapping
 * @throws APIManagementException if an error occurs when generating swagger
 */
public static String getSoapOperationMapping(byte[] wsdlContent) throws APIManagementException {
    WSDL11SOAPOperationExtractor processor = APIMWSDLReader.getWSDLSOAPOperationExtractor(wsdlContent);
    WSDLInfo wsdlInfo = processor.getWsdlInfo();
    return getGeneratedSwaggerFromWSDL(wsdlInfo);
}
Also used : WSDLInfo(org.wso2.carbon.apimgt.impl.wsdl.model.WSDLInfo) WSDL11SOAPOperationExtractor(org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor)

Example 2 with WSDL11SOAPOperationExtractor

use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.

the class SOAPOperationBindingUtils method getWSDL11SOAPOperationExtractor.

/**
 * Gets WSDL processor used to extract the soap binding operations
 *
 * @param content    WSDL content
 * @param wsdlReader WSDL reader used to parse the wsdl{@link APIMWSDLReader}
 * @return {@link WSDLProcessor}
 * @throws APIManagementException
 */
public static WSDL11SOAPOperationExtractor getWSDL11SOAPOperationExtractor(byte[] content, APIMWSDLReader wsdlReader) throws APIManagementException {
    WSDL11SOAPOperationExtractor wsdl11SOAPOperationExtractor = new WSDL11SOAPOperationExtractor(wsdlReader);
    wsdl11SOAPOperationExtractor.init(content);
    return wsdl11SOAPOperationExtractor;
}
Also used : WSDL11SOAPOperationExtractor(org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor)

Example 3 with WSDL11SOAPOperationExtractor

use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.

the class APIMWSDLReader method getWSDLSOAPOperationExtractor.

/**
 * Returns a WSDL11SOAPOperationExtractor for the WSDL byte content {@code content}. Only WSDL 1.1 is supported.
 *
 * @param content WSDL byte[] content
 * @return WSDL11SOAPOperationExtractor for the provided URL
 * @throws APIManagementException If an error occurs while determining the processor
 */
public static WSDL11SOAPOperationExtractor getWSDLSOAPOperationExtractor(byte[] content) throws APIManagementException {
    WSDL11SOAPOperationExtractor processor = new WSDL11SOAPOperationExtractor();
    processor.init(content);
    return processor;
}
Also used : WSDL11SOAPOperationExtractor(org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor)

Example 4 with WSDL11SOAPOperationExtractor

use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.

the class APIMWSDLReader method getWSDLSOAPOperationExtractorForUrl.

/**
 * Returns a WSDL11SOAPOperationExtractor for the url {@code url}. Only WSDL 1.1 is supported.
 *
 * @param url WSDL url
 * @return WSDL11SOAPOperationExtractor for the provided URL
 * @throws APIManagementException If an error occurs while determining the processor
 */
public static WSDL11SOAPOperationExtractor getWSDLSOAPOperationExtractorForUrl(URL url) throws APIManagementException {
    WSDL11SOAPOperationExtractor processor = new WSDL11SOAPOperationExtractor();
    processor.init(url);
    return processor;
}
Also used : WSDL11SOAPOperationExtractor(org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor)

Example 5 with WSDL11SOAPOperationExtractor

use of org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor in project carbon-apimgt by wso2.

the class SOAPOperationBindingTestCase method testGetWSDLProcessor.

@Test
public void testGetWSDLProcessor() throws Exception {
    APIMWSDLReader wsdlReader = new APIMWSDLReader(Thread.currentThread().getContextClassLoader().getResource("wsdls/phoneverify.wsdl").toExternalForm());
    byte[] wsdlContent = wsdlReader.getWSDL();
    WSDL11SOAPOperationExtractor processor = SOAPOperationBindingUtils.getWSDL11SOAPOperationExtractor(wsdlContent, wsdlReader);
    Assert.assertNotNull(processor);
    Assert.assertTrue("Failed to get soap binding operations from the WSDL", processor.getWsdlInfo().getSoapBindingOperations().size() > 0);
}
Also used : APIMWSDLReader(org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

APIMWSDLReader (org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader)8 WSDL11SOAPOperationExtractor (org.wso2.carbon.apimgt.impl.wsdl.WSDL11SOAPOperationExtractor)7 Test (org.junit.Test)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 ModelImpl (io.swagger.models.ModelImpl)4 WSDLInfo (org.wso2.carbon.apimgt.impl.wsdl.model.WSDLInfo)3 WSDLSOAPOperation (org.wso2.carbon.apimgt.impl.wsdl.model.WSDLSOAPOperation)2 URL (java.net.URL)1 Before (org.junit.Before)1