@Override
public void send(Message message, TestContext context) {
Assert.notNull(message, "Message is empty - unable to send empty message");
SoapMessage soapMessage;
if (message instanceof SoapMessage) {
soapMessage = (SoapMessage) message;
} else {
soapMessage = new SoapMessage(message);
}
String correlationKey = getEndpointConfiguration().getCorrelator().getCorrelationKey(soapMessage);
context.saveCorrelationKey(correlationKey, this);
String endpointUri;
if (getEndpointConfiguration().getEndpointResolver() != null) {
endpointUri = getEndpointConfiguration().getEndpointResolver().resolveEndpointUri(soapMessage, getEndpointConfiguration().getDefaultUri());
} else { // use default uri
endpointUri = getEndpointConfiguration().getDefaultUri();
}
log.info("Sending SOAP message to endpoint: '" + endpointUri + "'");
if (log.isDebugEnabled()) {
log.debug("Message to send is:\n" + soapMessage.toString());
}
if (!(soapMessage.getPayload() instanceof String)) {
throw new CitrusRuntimeException("Unsupported payload type '" + soapMessage.getPayload().getClass() +
"' Currently only 'java.lang.String' is supported as payload type.");
}
SoapRequestMessageCallback requestCallback = new SoapRequestMessageCallback(soapMessage, getEndpointConfiguration());