From 80e205452b7966c5bb5dcda66d1a5f4159f5161a Mon Sep 17 00:00:00 2001 From: Hector Ventura Date: Sun, 5 Apr 2026 10:27:43 -0500 Subject: [PATCH] fix(ses): add missing Result element to query protocol responses (#207) --- .../hectorvent/floci/core/common/AwsQueryResponse.java | 8 ++++++++ .../hectorvent/floci/services/ses/SesQueryHandler.java | 6 +++--- .../floci/services/ses/SesIntegrationTest.java | 9 ++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java index 34056341a0..84e54b2269 100644 --- a/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java +++ b/src/main/java/io/github/hectorvent/floci/core/common/AwsQueryResponse.java @@ -77,6 +77,14 @@ public final class AwsQueryResponse { .build(); } + /** + * Same as {@link #envelope} but with an empty Result element. + * Some services (e.g. SES) require the Result element even if it is empty. + */ + public static String envelopeEmptyResult(String action, String xmlns) { + return envelope(action, xmlns, ""); + } + /** * Builds a Query-protocol XML error response and returns a JAX-RS {@link Response}. * diff --git a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java index 898e03c253..3499c09d93 100644 --- a/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java +++ b/src/main/java/io/github/hectorvent/floci/services/ses/SesQueryHandler.java @@ -62,7 +62,7 @@ public class SesQueryHandler { private Response handleVerifyEmailIdentity(MultivaluedMap params, String region) { String emailAddress = getParam(params, "EmailAddress"); sesService.verifyEmailIdentity(emailAddress, region); - return Response.ok(AwsQueryResponse.envelopeNoResult("VerifyEmailIdentity", AwsNamespaces.SES)).build(); + return Response.ok(AwsQueryResponse.envelopeEmptyResult("VerifyEmailIdentity", AwsNamespaces.SES)).build(); } private Response handleVerifyEmailAddress(MultivaluedMap params, String region) { @@ -81,7 +81,7 @@ public class SesQueryHandler { private Response handleDeleteIdentity(MultivaluedMap params, String region) { String identityValue = getParam(params, "Identity"); sesService.deleteIdentity(identityValue, region); - return Response.ok(AwsQueryResponse.envelopeNoResult("DeleteIdentity", AwsNamespaces.SES)).build(); + return Response.ok(AwsQueryResponse.envelopeEmptyResult("DeleteIdentity", AwsNamespaces.SES)).build(); } private Response handleListIdentities(MultivaluedMap params, String region) { @@ -197,7 +197,7 @@ public class SesQueryHandler { String notificationType = getParam(params, "NotificationType"); String snsTopic = getParam(params, "SnsTopic"); sesService.setIdentityNotificationTopic(identityValue, notificationType, snsTopic, region); - return Response.ok(AwsQueryResponse.envelopeNoResult("SetIdentityNotificationTopic", AwsNamespaces.SES)).build(); + return Response.ok(AwsQueryResponse.envelopeEmptyResult("SetIdentityNotificationTopic", AwsNamespaces.SES)).build(); } private Response handleGetIdentityNotificationAttributes(MultivaluedMap params, String region) { diff --git a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java index 06e456e667..6dc87974f1 100644 --- a/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/ses/SesIntegrationTest.java @@ -28,7 +28,8 @@ class SesIntegrationTest { .post("/") .then() .statusCode(200) - .body(containsString("VerifyEmailIdentityResponse")); + .body(containsString("VerifyEmailIdentityResponse")) + .body(containsString("VerifyEmailIdentityResult")); } @Test @@ -265,7 +266,8 @@ class SesIntegrationTest { .when() .post("/") .then() - .statusCode(200); + .statusCode(200) + .body(containsString("SetIdentityNotificationTopicResult")); } @Test @@ -320,7 +322,8 @@ class SesIntegrationTest { .when() .post("/") .then() - .statusCode(200); + .statusCode(200) + .body(containsString("DeleteIdentityResult")); // Verify it's gone given()