use of org.mule.runtime.soap.api.message.SoapResponse in project mule by mulesoft.
the class TestSoapClient method consume.
@Override
public SoapResponse consume(SoapRequest request, MessageDispatcher dispatcher) {
SoapResponse response = mock(SoapResponse.class);
when(response.getContent()).thenReturn(new ByteArrayInputStream("Content".getBytes()));
return response;
}
use of org.mule.runtime.soap.api.message.SoapResponse in project mule by mulesoft.
the class ForwardingSoapClientTestCase method loadClient.
@Test
public void loadClient() throws Exception {
SoapClient sc = client.getSoapClient("uno");
SoapResponse response = sc.consume(SoapRequest.empty("no-op"));
assertThat(IOUtils.toString(response.getContent()), is("Content"));
}
use of org.mule.runtime.soap.api.message.SoapResponse 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