use of org.mule.runtime.soap.api.message.SoapRequestBuilder in project mule by mulesoft.
the class SoapOperationExecutor method getRequest.
/**
* Builds a Soap Request with the execution context to be sent using the {@link SoapClient}.
*/
private SoapRequest getRequest(ExecutionContext<OperationModel> context, Map<String, String> fixedHeaders) throws MessageTransformerException, TransformerException {
SoapRequestBuilder builder = SoapRequest.builder().operation(getOperation(context));
builder.soapHeaders(fixedHeaders);
Optional<Object> optionalMessageGroup = getParam(context, MESSAGE_GROUP);
if (optionalMessageGroup.isPresent()) {
Map<String, Object> message = (Map<String, Object>) optionalMessageGroup.get();
InputStream body = (InputStream) message.get(BODY_PARAM);
if (body != null) {
builder.content(body);
}
InputStream headers = (InputStream) message.get(HEADERS_PARAM);
if (headers != null) {
builder.soapHeaders((Map<String, String>) evaluateHeaders(headers));
}
Map<String, TypedValue<?>> attachments = (Map<String, TypedValue<?>>) message.get(ATTACHMENTS_PARAM);
if (attachments != null) {
toSoapAttachments(attachments).forEach(builder::attachment);
}
}
getParam(context, TRANSPORT_HEADERS_PARAM).ifPresent(th -> builder.transportHeaders((Map<String, String>) th));
return builder.build();
}
Aggregations