Search in sources :

Example 1 with Definitions

use of com.predic8.wsdl.Definitions in project service-proxy by membrane.

the class WebServiceExplorerInterceptor method generateSampleRequest.

private String generateSampleRequest(final String portName, final String operationName, final String bindingName, final Definitions w) {
    StringWriter writer = new StringWriter();
    SOARequestCreator creator = new SOARequestCreator(w, new RequestTemplateCreator(), new MarkupBuilder(writer));
    creator.createRequest(portName, operationName, bindingName);
    return writer.toString();
}
Also used : RequestTemplateCreator(com.predic8.wstool.creator.RequestTemplateCreator) StringWriter(java.io.StringWriter) MarkupBuilder(groovy.xml.MarkupBuilder) SOARequestCreator(com.predic8.wstool.creator.SOARequestCreator)

Example 2 with Definitions

use of com.predic8.wsdl.Definitions in project service-proxy by membrane.

the class WebServiceExplorerInterceptor method getParsedWSDL.

private Definitions getParsedWSDL() {
    if (parsedWSDL != null)
        return parsedWSDL;
    WSDLParserContext ctx = new WSDLParserContext();
    ctx.setInput(ResolverMap.combine(router.getBaseLocation(), wsdl));
    WSDLParser wsdlParser = new WSDLParser();
    wsdlParser.setResourceResolver(router.getResolverMap().toExternalResolver().toExternalResolver());
    return parsedWSDL = wsdlParser.parse(ctx);
}
Also used : WSDLParser(com.predic8.wsdl.WSDLParser) WSDLParserContext(com.predic8.wsdl.WSDLParserContext)

Example 3 with Definitions

use of com.predic8.wsdl.Definitions in project irontest by zheng-wang.

the class WSDLResource method getOperationInfo.

@GET
@Path("/{wsdlUrl}/bindings/{bindingName}/operations/{operationName}")
public SOAPOperationInfo getOperationInfo(@PathParam("wsdlUrl") String wsdlUrl, @PathParam("bindingName") String bindingName, @PathParam("operationName") String operationName) {
    SOAPOperationInfo info = new SOAPOperationInfo();
    WSDLParser parser = new WSDLParser();
    Definitions definition = parser.parse(wsdlUrl);
    StringWriter writer = new StringWriter();
    SOARequestCreator creator = new SOARequestCreator(definition, new RequestTemplateCreator(), new MarkupBuilder(writer));
    creator.createRequest(null, operationName, bindingName);
    info.setSampleRequest(writer.toString());
    return info;
}
Also used : RequestTemplateCreator(com.predic8.wstool.creator.RequestTemplateCreator) StringWriter(java.io.StringWriter) Definitions(com.predic8.wsdl.Definitions) MarkupBuilder(groovy.xml.MarkupBuilder) SOAPOperationInfo(io.irontest.models.teststep.SOAPOperationInfo) WSDLParser(com.predic8.wsdl.WSDLParser) SOARequestCreator(com.predic8.wstool.creator.SOARequestCreator) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 4 with Definitions

use of com.predic8.wsdl.Definitions in project service-proxy by membrane.

the class ResolverTest method testMembraneSoaModel.

@Test
public void testMembraneSoaModel() throws IOException {
    if (hit = !setupLocations())
        return;
    try {
        WSDLParserContext ctx = new WSDLParserContext();
        ctx.setInput(wsdlLocation);
        WSDLParser wsdlParser = new WSDLParser();
        wsdlParser.setResourceResolver(resolverMap.toExternalResolver().toExternalResolver());
        Definitions definitions = wsdlParser.parse(ctx);
        for (Schema schema : definitions.getSchemas()) // trigger lazy-loading
        schema.getElements();
    } catch (Exception e) {
        throw new RuntimeException("wsdlLocation = " + xsdLocation, e);
    }
}
Also used : Definitions(com.predic8.wsdl.Definitions) Schema(com.predic8.schema.Schema) WSDLParser(com.predic8.wsdl.WSDLParser) WSDLParserContext(com.predic8.wsdl.WSDLParserContext) InvalidParameterException(java.security.InvalidParameterException) IOException(java.io.IOException) Test(org.junit.Test)

Example 5 with Definitions

use of com.predic8.wsdl.Definitions in project service-proxy by membrane.

the class WebServiceExplorerInterceptor method createOperationResponse.

@Mapping("[^?]*/operation/([^/?]+)/([^/?]+)/([^/?]+)")
public Response createOperationResponse(QueryParameter params, String relativeRootPath) throws Exception {
    try {
        final String bindingName = params.getGroup(1);
        final String portName = params.getGroup(2);
        final String operationName = params.getGroup(3);
        final Definitions w = getParsedWSDL();
        final Service service = getService(w);
        StringWriter sw = new StringWriter();
        new StandardPage(sw, null) {

            @Override
            protected void createContent() {
                h1().text("Service Proxy for " + service.getName());
                h2().text("Operation: " + operationName).end();
                h3().text("Sample Request").end();
                pre().text(generateSampleRequest(portName, operationName, bindingName, w)).end();
            }
        };
        return Response.ok(sw.toString()).build();
    } catch (IllegalArgumentException e) {
        log.error("", e);
        return Response.internalServerError().build();
    }
}
Also used : StringWriter(java.io.StringWriter) Definitions(com.predic8.wsdl.Definitions) Service(com.predic8.wsdl.Service) Mapping(com.predic8.membrane.core.interceptor.administration.Mapping)

Aggregations

Definitions (com.predic8.wsdl.Definitions)7 WSDLParser (com.predic8.wsdl.WSDLParser)6 StringWriter (java.io.StringWriter)5 Service (com.predic8.wsdl.Service)3 WSDLParserContext (com.predic8.wsdl.WSDLParserContext)3 RequestTemplateCreator (com.predic8.wstool.creator.RequestTemplateCreator)3 SOARequestCreator (com.predic8.wstool.creator.SOARequestCreator)3 MarkupBuilder (groovy.xml.MarkupBuilder)3 Mapping (com.predic8.membrane.core.interceptor.administration.Mapping)2 Binding (com.predic8.wsdl.Binding)2 Port (com.predic8.wsdl.Port)2 ArrayList (java.util.ArrayList)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 SSLParser (com.predic8.membrane.core.config.security.SSLParser)1 ResourceRetrievalException (com.predic8.membrane.core.resolver.ResourceRetrievalException)1 Schema (com.predic8.schema.Schema)1 BindingOperation (com.predic8.wsdl.BindingOperation)1 Documentation (com.predic8.wsdl.Documentation)1 Operation (com.predic8.wsdl.Operation)1