public SoapWsConsumer(Endpoint endpoint, SoapWsConfiguration configuration, Processor processor) { super(endpoint, processor); this.configuration = configuration; builder = Wsdl.parse(ResourceUtils.getResource(configuration.getWsdl()).toString()) .binding() .localPart(configuration.getLocalPart()) .find(); }
public Wsdl validateWsdl(String url) { try { Wsdl wsdl = Wsdl.parse(url); messages.info("validated"); return wsdl; } catch (Exception e) { messages.error(e.getMessage()); } return null; }
public List<String> getOperations(String url) { List<String> result = new ArrayList<>(); try { Wsdl wsdl = Wsdl.parse(url); List<QName> bindings = wsdl.getBindings(); for (QName binding : bindings) { SoapBuilder builder = wsdl.binding().localPart(binding.getLocalPart()).find(); for (SoapOperation operation : builder.getOperations()) result.add(operation.getOperationName()); } } catch (Exception e) { logger.info(e.getLocalizedMessage()); } return result; }
public String generateResponseRequestForOperation(String url, String operation) { String result = ""; try { Wsdl wsdl = Wsdl.parse(url); List<QName> bindings = wsdl.getBindings(); for (QName binding : bindings) { SoapBuilder builder = wsdl.binding().localPart(binding.getLocalPart()).find(); SoapOperationBuilder operationBuilder = builder.operation().name(operation).find(); if (operationBuilder != null) { SoapContext sc = new SoapContext(false, true, true, true, false); result = operationBuilder.buildOutputMessage(sc); break; } } } catch (Exception e) { logger.info(e.getLocalizedMessage()); } return result; }