use of com.predic8.wsdl.Documentation in project service-proxy by membrane.
the class HelpReference method handleDoc.
private void handleDoc(AbstractJavadocedInfo info) throws XMLStreamException {
Doc doc = info.getDoc(processingEnv);
if (doc == null)
return;
xew.writeStartElement("documentation");
for (Doc.Entry e : doc.getEntries()) handleDoc(e);
xew.writeEndElement();
}
use of com.predic8.wsdl.Documentation in project service-proxy by membrane.
the class WebServiceExplorerInterceptor method createSOAPUIResponse.
@Mapping("(?!.*operation)([^?]*)")
public Response createSOAPUIResponse(QueryParameter params, final String relativeRootPath, final Exchange exc) throws Exception {
try {
final String myPath = router.getUriFactory().create(exc.getRequestURI()).getPath();
final Definitions w = getParsedWSDL();
final Service service = getService(w);
final Port port = SOAPProxy.selectPort(service.getPorts(), portName);
final List<Port> ports = getPortsByLocation(service, port);
StringWriter sw = new StringWriter();
new StandardPage(sw, service.getName()) {
@Override
protected void createContent() {
h1().text("Service Proxy: " + service.getName()).end();
p();
text("Target Namespace: " + w.getTargetNamespace());
br().end();
String wsdlLink = getClientURL(exc) + "?wsdl";
text("WSDL: ").a().href(wsdlLink).text(wsdlLink).end();
end();
for (PortType pt : w.getPortTypes()) {
h2().text("Port Type: " + pt.getName()).end();
Documentation d = pt.getDocumentation();
if (d != null) {
p().text("Documentation: " + d.toString()).end();
}
}
Binding binding = port.getBinding();
PortType portType = binding.getPortType();
List<Operation> bindingOperations = getOperationsByBinding(w, binding);
if (bindingOperations.isEmpty())
p().text("There are no operations defined.").end();
else
createOperationsTable(w, bindingOperations, binding, portType);
h2().text("Virtual Endpoint").end();
p().a().href(getClientURL(exc)).text(getClientURL(exc)).end().end();
h2().text("Target Endpoints").end();
if (service.getPorts().isEmpty())
p().text("There are no endpoints defined.").end();
else
createEndpointTable(service.getPorts(), ports);
}
private void createOperationsTable(Definitions w, List<Operation> bindingOperations, Binding binding, PortType portType) {
table().cellspacing("0").cellpadding("0").border("" + 1);
tr();
th().text("Operation").end();
th().text("Input").end();
th().text("Output").end();
end();
for (Operation o : bindingOperations) {
tr();
td();
if ("HTTP".equals(getProtocolVersion(binding))) {
text(o.getName());
} else {
String link = myPath + "/operation/" + binding.getName() + "/" + portType.getName() + "/" + o.getName();
a().href(link).text(o.getName()).end();
}
end();
td();
for (Part p : o.getInput().getMessage().getParts()) text(p.getElement().getName());
end();
td();
for (Part p : o.getOutput().getMessage().getParts()) text(p.getElement().getName());
end();
end();
}
end();
}
private void createEndpointTable(List<Port> ports, List<Port> matchingPorts) {
table().cellspacing("0").cellpadding("0").border("" + 1);
tr();
th().text("Port Name").end();
th().text("Protocol").end();
th().text("URL").end();
end();
for (Port p : ports) {
tr();
td().text(p.getName()).end();
td().text(getProtocolVersion(p.getBinding())).end();
td().text(p.getAddress().getLocation()).end();
td();
if (matchingPorts.contains(p))
text("*");
end();
end();
}
end();
p().small().text("* available through this proxy").end().end();
}
};
return Response.ok(sw.toString()).build();
} catch (IllegalArgumentException e) {
log.error("", e);
return Response.internalServerError().build();
}
}
Aggregations