aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r--src/main/java/at/gv/egiz/moazs/App2MzsService.java29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/App2MzsService.java b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
index 03d99fe..c89083f 100644
--- a/src/main/java/at/gv/egiz/moazs/App2MzsService.java
+++ b/src/main/java/at/gv/egiz/moazs/App2MzsService.java
@@ -9,12 +9,14 @@ import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs.App2MzsPort
import at.gv.e_government.reference.namespace.zustellung.mzs.app2mzs_.DeliveryRequestType;
import at.gv.egiz.moazs.pipeline.DeliveryPipeline;
import at.gv.egiz.moazs.repository.DeliveryRepository;
+import org.apache.cxf.binding.soap.SoapFault;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.jws.WebParam;
+import javax.xml.XMLConstants;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@@ -50,22 +52,22 @@ public class App2MzsService implements App2MzsPortType {
targetNamespace = MZSTNS)
DeliveryRequestType deliveryRequest) {
- final var appDeliveryID = deliveryRequest.getMetaData().getAppDeliveryID();
-
var future = supplyAsync(() -> preprocessor.preProcess(deliveryRequest))
- .thenApply((request) -> process(request));
+ .thenApply(this::process);
try {
return future.get(TIMEOUT_FOR_ANWSER, TimeUnit.SECONDS);
} catch (TimeoutException e) {
future.thenAccept(appClient::sendNotification);
logger.info("Answer Timed Out", e);
+
+ var appDeliveryID = deliveryRequest.getMetaData().getAppDeliveryID();
return generatePartialSuccessResponse(appDeliveryID);
} catch (Exception e ) {
logger.error("Could not deliver request.", e);
- var message = format("An error occured while delivering request: {0}", e.getMessage());
- return generateErrorResponse(appDeliveryID, message);
+ var message = format("An error occurred while processing DeliveryRequest");
+ throw new RuntimeException(message, e);
}
}
@@ -94,21 +96,4 @@ public class App2MzsService implements App2MzsPortType {
.build();
}
- private DeliveryRequestStatusType generateErrorResponse(String appDeliveryId, String message) {
-
- var info = new ErrorInfoTypeBuilder()
- .withCode("500")
- .withText(message)
- .build();
-
- var error = new ErrorBuilder()
- .withAppDeliveryID(appDeliveryId)
- .withErrorInfo(info)
- .build();
-
- return new DeliveryRequestStatusTypeBuilder()
- .withError(error)
- .build();
- }
-
} \ No newline at end of file