Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72131ed

Browse files
author
Andrew Tang
authored
Decode service escaped xml characters.
If we use <tag> as part of the API member's value to services using xml protocol. <tag> will be XML escaped to &lt;tag&gt; in returned xml body. We need to decode the escaped string to it's original form.
1 parent 22511cc commit 72131ed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ TEST_F(QueueOperationTest, TestSendReceiveDelete)
230230
ASSERT_TRUE(queueUrl.find(queueName) != Aws::String::npos);
231231

232232
SendMessageRequest sendMessageRequest;
233-
sendMessageRequest.SetMessageBody(" TestMessageBody\r\n ");
233+
sendMessageRequest.SetMessageBody(" TestMessageBody<tag>info\"\"</tag>\r\n ");
234234
MessageAttributeValue stringAttributeValue;
235235
stringAttributeValue.SetStringValue("TestString");
236236
stringAttributeValue.SetDataType("String");
@@ -263,7 +263,7 @@ TEST_F(QueueOperationTest, TestSendReceiveDelete)
263263
ReceiveMessageResult receiveMessageResult = receiveMessageOutcome.GetResult();
264264
ASSERT_EQ(1uL, receiveMessageResult.GetMessages().size());
265265
Aws::String receivedMessage = receiveMessageResult.GetMessages()[0].GetBody();
266-
EXPECT_STREQ(" TestMessageBody\r\n ", receivedMessage.c_str());
266+
EXPECT_STREQ(" TestMessageBody<tag>info\"\"</tag>\r\n ", receivedMessage.c_str());
267267
EXPECT_STREQ(HashingUtils::HexEncode(HashingUtils::CalculateMD5(receivedMessage)).c_str(), receiveMessageResult.GetMessages()[0].GetMD5OfBody().c_str());
268268
Aws::Map<Aws::String, MessageAttributeValue> messageAttributes = receiveMessageResult.GetMessages()[0].GetMessageAttributes();
269269
ASSERT_TRUE(messageAttributes.find("TestStringAttribute") != messageAttributes.end());

code-generation/generator/src/main/resources/com/amazonaws/util/awsclientgenerator/velocity/cpp/xml/ModelClassMembersDeserializeXml.vm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
#end##member uses location for serialization
6767
#else##this is not a map or a list
68-
#set($substituteString = "${lowerCaseVarName}Node.GetText()")
68+
#set($substituteString = "Aws::Utils::Xml::DecodeEscapedXmlText(${lowerCaseVarName}Node.GetText())")
6969
#if($member.locationName)##location specified
7070
#if($member.xmlAttribute)
7171
auto ${lowerCaseVarName} = resultNode.GetAttributeValue("${member.locationName}");

0 commit comments

Comments
 (0)