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();
}
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);
}
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;
}
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);
}
}
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();
}
}
Aggregations