Search in sources :

Example 1 with SoapRequest

use of org.mule.runtime.soap.api.message.SoapRequest 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));
    }
}
Also used : HEADERS_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.HEADERS_PARAM) Exceptions.wrapFatal(org.mule.runtime.core.api.rx.Exceptions.wrapFatal) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) MessageTransformerException(org.mule.runtime.core.api.transformer.MessageTransformerException) BindingContext(org.mule.runtime.api.el.BindingContext) MuleExpressionLanguage(org.mule.runtime.api.el.MuleExpressionLanguage) ComponentExecutor(org.mule.runtime.extension.api.runtime.operation.ComponentExecutor) ATTACHMENTS_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.ATTACHMENTS_PARAM) HashMap(java.util.HashMap) SoapRequestBuilder(org.mule.runtime.soap.api.message.SoapRequestBuilder) Inject(javax.inject.Inject) ExtensionsClientArgumentResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExtensionsClientArgumentResolver) ConnectionArgumentResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ConnectionArgumentResolver) MESSAGE_GROUP(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.MESSAGE_GROUP) SoapClient(org.mule.runtime.soap.api.client.SoapClient) Map(java.util.Map) SoapResponse(org.mule.runtime.soap.api.message.SoapResponse) Registry(org.mule.runtime.api.artifact.Registry) IOUtils(org.mule.runtime.core.api.util.IOUtils) PolicyManager(org.mule.runtime.core.internal.policy.PolicyManager) Mono.error(reactor.core.publisher.Mono.error) INPUT_STREAM(org.mule.runtime.api.metadata.DataType.INPUT_STREAM) BODY_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.BODY_PARAM) TransformationService(org.mule.runtime.api.transformation.TransformationService) ExecutionContext(org.mule.runtime.extension.api.runtime.operation.ExecutionContext) OPERATION_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.OPERATION_PARAM) DataType(org.mule.runtime.api.metadata.DataType) Publisher(org.reactivestreams.Publisher) SoapRequest(org.mule.runtime.soap.api.message.SoapRequest) Mono.justOrEmpty(reactor.core.publisher.Mono.justOrEmpty) TransformerException(org.mule.runtime.core.api.transformer.TransformerException) SoapAttachment(org.mule.runtime.extension.api.soap.SoapAttachment) SERVICE_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.SERVICE_PARAM) TypedValue(org.mule.runtime.api.metadata.TypedValue) TRANSPORT_HEADERS_PARAM(org.mule.runtime.module.extension.soap.internal.loader.SoapInvokeOperationDeclarer.TRANSPORT_HEADERS_PARAM) StreamingHelperArgumentResolver(org.mule.runtime.module.extension.internal.runtime.resolver.StreamingHelperArgumentResolver) ForwardingSoapClient(org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient) ExtensionsClient(org.mule.runtime.extension.api.client.ExtensionsClient) Optional(java.util.Optional) SoapExceptionEnricher(org.mule.runtime.soap.api.exception.error.SoapExceptionEnricher) InputStream(java.io.InputStream) SoapClient(org.mule.runtime.soap.api.client.SoapClient) ForwardingSoapClient(org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient) MessageTransformerException(org.mule.runtime.core.api.transformer.MessageTransformerException) TransformerException(org.mule.runtime.core.api.transformer.TransformerException) ForwardingSoapClient(org.mule.runtime.module.extension.soap.internal.runtime.connection.ForwardingSoapClient) SoapRequest(org.mule.runtime.soap.api.message.SoapRequest) SoapResponse(org.mule.runtime.soap.api.message.SoapResponse) ExtensionsClientArgumentResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExtensionsClientArgumentResolver) MessageTransformerException(org.mule.runtime.core.api.transformer.MessageTransformerException) MessageTransformerException(org.mule.runtime.core.api.transformer.MessageTransformerException) TransformerException(org.mule.runtime.core.api.transformer.TransformerException)

Aggregations

InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Inject (javax.inject.Inject)1 Registry (org.mule.runtime.api.artifact.Registry)1 BindingContext (org.mule.runtime.api.el.BindingContext)1 MuleExpressionLanguage (org.mule.runtime.api.el.MuleExpressionLanguage)1 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)1 DataType (org.mule.runtime.api.metadata.DataType)1 INPUT_STREAM (org.mule.runtime.api.metadata.DataType.INPUT_STREAM)1 TypedValue (org.mule.runtime.api.metadata.TypedValue)1 TransformationService (org.mule.runtime.api.transformation.TransformationService)1 Exceptions.wrapFatal (org.mule.runtime.core.api.rx.Exceptions.wrapFatal)1 MessageTransformerException (org.mule.runtime.core.api.transformer.MessageTransformerException)1 TransformerException (org.mule.runtime.core.api.transformer.TransformerException)1 IOUtils (org.mule.runtime.core.api.util.IOUtils)1 PolicyManager (org.mule.runtime.core.internal.policy.PolicyManager)1 ExtensionsClient (org.mule.runtime.extension.api.client.ExtensionsClient)1 ComponentExecutor (org.mule.runtime.extension.api.runtime.operation.ComponentExecutor)1