diff --git a/smithy-aws-protocol-tests/model/restXml/http-payload.smithy b/smithy-aws-protocol-tests/model/restXml/http-payload.smithy index eedf0f39743..c99e6a6a9d5 100644 --- a/smithy-aws-protocol-tests/model/restXml/http-payload.smithy +++ b/smithy-aws-protocol-tests/model/restXml/http-payload.smithy @@ -285,6 +285,62 @@ structure PayloadWithXmlName { name: String } +/// The following example serializes a body that uses an XML name, +/// changing the wrapper name. +@idempotent +@http(uri: "/BodyWithXmlName", method: "PUT") +operation BodyWithXmlName { + input: BodyWithXmlNameInputOutput, + output: BodyWithXmlNameInputOutput +} + +apply BodyWithXmlName @httpRequestTests([ + { + id: "BodyWithXmlName", + documentation: "Serializes a payload using a wrapper name based on the xmlName", + protocol: restXml, + method: "PUT", + uri: "/BodyWithXmlName", + body: "<Ahoy><name>Phreddy</name></Ahoy>", + bodyMediaType: "application/xml", + headers: { + "Content-Type": "application/xml" + }, + requireHeaders: [ + "Content-Length" + ], + params: { + nested: { + name: "Phreddy" + } + } + } +]) + +apply BodyWithXmlName @httpResponseTests([ + { + id: "BodyWithXmlName", + documentation: "Serializes a payload using a wrapper name based on the xmlName", + protocol: restXml, + code: 200, + body: "<Ahoy><name>Phreddy</name></Ahoy>", + bodyMediaType: "application/xml", + headers: { + "Content-Type": "application/xml" + }, + params: { + nested: { + name: "Phreddy" + } + } + } +]) + +@xmlName("Ahoy") +structure BodyWithXmlNameInputOutput { + nested: PayloadWithXmlName, +} + /// The following example serializes a payload that uses an XML name /// on the member, changing the wrapper name. diff --git a/smithy-aws-protocol-tests/model/restXml/main.smithy b/smithy-aws-protocol-tests/model/restXml/main.smithy index 8dbf89bd2ac..8867ff1334e 100644 --- a/smithy-aws-protocol-tests/model/restXml/main.smithy +++ b/smithy-aws-protocol-tests/model/restXml/main.smithy @@ -50,6 +50,7 @@ service RestXml { HttpPayloadTraitsWithMediaType, HttpPayloadWithStructure, HttpPayloadWithXmlName, + BodyWithXmlName, HttpPayloadWithMemberXmlName, HttpPayloadWithXmlNamespace, HttpPayloadWithXmlNamespaceAndPrefix,