try {
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(new StringSource(soapMessage.getPayload().toString()), soapRequest.getSoapBody().getPayloadResult());
} catch (TransformerException e) {
throw new CitrusRuntimeException("Failed to write SOAP body payload", e);
}
// Copy headers into soap-header:
for (Entry<String, Object> headerEntry : soapMessage.copyHeaders().entrySet()) {
if (MessageHeaderUtils.isSpringInternalHeader(headerEntry.getKey())) {
continue;
}
if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.SOAP_ACTION)) {
soapRequest.setSoapAction(headerEntry.getValue().toString());
} else if (headerEntry.getKey().toLowerCase().startsWith(SoapMessageHeaders.HTTP_PREFIX)) {
handleOutboundMimeMessageHeader(soapRequest,
headerEntry.getKey().substring(SoapMessageHeaders.HTTP_PREFIX.length()),
headerEntry.getValue(),
endpointConfiguration.isHandleMimeHeaders());
} else if (!headerEntry.getKey().startsWith(MessageHeaders.PREFIX)) {
SoapHeaderElement headerElement;
if (QNameUtils.validateQName(headerEntry.getKey())) {
headerElement = soapRequest.getSoapHeader().addHeaderElement(QNameUtils.parseQNameString(headerEntry.getKey()));
} else {
headerElement = soapRequest.getSoapHeader().addHeaderElement(QNameUtils.createQName("", headerEntry.getKey(), ""));
}
headerElement.setText(headerEntry.getValue().toString());
}
}
for (String headerData : soapMessage.getHeaderData()) {
try {
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(new StringSource(headerData),
soapRequest.getSoapHeader().getResult());
} catch (TransformerException e) {
throw new CitrusRuntimeException("Failed to write SOAP header content", e);
}
}
for (final Attachment attachment : soapMessage.getAttachments()) {
if (log.isDebugEnabled()) {