use of org.springframework.ws.transport.http.HttpUrlConnection in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class CxLegacyService method getWSCallback.
private WebServiceMessageCallback getWSCallback(String callbackUri, String token) {
String curToken;
if (properties.getEnableShardManager()) {
ShardSession shard = sessionTracker.getShardSession();
curToken = shard.getSoapToken();
} else {
curToken = token;
}
return message -> {
SoapMessage soapMessage = (SoapMessage) message;
soapMessage.setSoapAction(callbackUri);
TransportContext context = TransportContextHolder.getTransportContext();
HttpUrlConnection connection = (HttpUrlConnection) context.getConnection();
try {
if (!ScanUtils.empty(curToken) && properties.getVersion() >= 9.0) {
connection.addRequestHeader(HttpHeaders.AUTHORIZATION, "Bearer ".concat(token));
}
} catch (IOException e) {
log.warn("Problem adding SOAP WS http header: {}", ExceptionUtils.getStackTrace(e));
}
};
}
Aggregations