Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDP-1868: Make soap client calls async #13

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public void handleIncomingRequest(final ProxyServerRequestMessage proxyServerReq
final String commonName = proxyServerRequestMessage.getCommonName();
final String soapPayload = proxyServerRequestMessage.getSoapPayload();

final boolean result = soapClient.sendRequest(connectionId, context, commonName, soapPayload);
if (!result) {
LOGGER.error("Unsuccessful at sending request to platform.");
} else {
LOGGER.debug("Successfully sent response message to queue");
}
soapClient.sendRequest(connectionId, context, commonName, soapPayload);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.gxf.soapbridge.valueobjects.ProxyServerResponseMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/** This {@link @Component} class can send SOAP messages to the Platform. */
Expand Down Expand Up @@ -54,10 +55,9 @@ public SoapClient(
* @param context The part of the URL indicating the SOAP web-service.
* @param commonName The common name (organisation identification).
* @param soapPayload The SOAP message to send to the platform.
* @return True if the request has been sent and the response has been received and written to a
* queue, false otherwise.
*/
public boolean sendRequest(
@Async
public void sendRequest(
final String connectionId,
final String context,
final String commonName,
Expand All @@ -70,7 +70,7 @@ public boolean sendRequest(
connection = createConnection(context, soapPayload, commonName);
if (connection == null) {
LOGGER.warn("Could not create connection for sending SOAP request.");
return false;
return;
}

// Send the SOAP payload to the server.
Expand All @@ -89,13 +89,11 @@ public boolean sendRequest(
// Send queue message.
proxyReponseSender.send(responseMessage);

return true;
} catch (final Exception e) {
if (connection != null) {
connection.disconnect();
}
LOGGER.error("Unexpected exception while sending SOAP request", e);
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ package org.gxf.soapbridge
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
import org.springframework.boot.runApplication
import org.springframework.scheduling.annotation.EnableAsync
import org.springframework.web.servlet.config.annotation.EnableWebMvc

@SpringBootApplication
@EnableWebMvc
@EnableAsync
@ConfigurationPropertiesScan
class SoapBridgeApplication

Expand Down
Loading