use of org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient in project mule by mulesoft.
the class InvokeKeysResolver method buildServiceKey.
private MetadataKey buildServiceKey(ForwardingSoapClient connection, WebServiceDefinition ws) {
String serviceId = ws.getServiceId();
SoapMetadataResolver resolver = connection.getSoapClient(serviceId).getMetadataResolver();
MetadataKeyBuilder key = newKey(serviceId).withDisplayName(ws.getFriendlyName());
List<String> excludedOperations = ws.getExcludedOperations();
resolver.getAvailableOperations().stream().filter(ope -> !excludedOperations.contains(ope)).forEach(ope -> key.withChild(newKey(ope).withDisplayName(NameUtils.titleize(ope))));
return key.build();
}
use of org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient in project mule by mulesoft.
the class InvokeKeysResolver method getKeys.
/**
* {@inheritDoc}
*
* Resolves multi-level metadata keys with the services available to hit and for each of the services exposes all
* available operations.
*/
@Override
public Set<MetadataKey> getKeys(MetadataContext context) throws MetadataResolvingException, ConnectionException {
ForwardingSoapClient connection = getConnection(context);
ImmutableSet.Builder<MetadataKey> keys = ImmutableSet.builder();
connection.getAllWebServices().forEach(ws -> keys.add(buildServiceKey(connection, ws)));
return keys.build();
}
use of org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient in project mule by mulesoft.
the class SoapOperationExecutor method execute.
/**
* {@inheritDoc}
*/
@Override
public Publisher<Object> execute(ExecutionContext<OperationModel> context) {
try {
String serviceId = context.getParameter(SERVICE_PARAM);
ForwardingSoapClient connection = (ForwardingSoapClient) connectionResolver.resolve(context).get();
Map<String, String> customHeaders = connection.getCustomHeaders(serviceId, getOperation(context));
SoapRequest request = getRequest(context, customHeaders);
SoapClient soapClient = connection.getSoapClient(serviceId);
SoapResponse response = connection.getExtensionsClientDispatcher(() -> new ExtensionsClientArgumentResolver(registry, policyManager).resolve(context).get()).map(d -> soapClient.consume(request, d)).orElseGet(() -> soapClient.consume(request));
return justOrEmpty(response.getAsResult(streamingHelperArgumentResolver.resolve(context).get()));
} catch (MessageTransformerException | TransformerException e) {
return error(e);
} catch (Exception e) {
return error(soapExceptionEnricher.enrich(e));
} catch (Throwable t) {
return error(wrapFatal(t));
}
}
Aggregations