","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"203","kudosSumWeight":0,"postTime":"2016-12-06T01:27:29.524-08:00","lastPublishTime":"2016-12-06T01:27:29.524-08:00","metrics":{"__typename":"MessageMetrics","views":3507},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:ready_api_forums/community:nwkab66374board:readyapi-questions/message:132262/message:132270","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuMnwyLjF8b3wzfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:132273"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"editFrozen":false,"body@stringLength":"1209","rawBody":"
The testRunner variable is not available in the ScriptAssertion window, you get the messageExchange exchange variable instead, this is the class WsdlResponseMessageExchange, and has the method getResponseContent() which you may find suits your needs.
Note: all the Groovy script editors provide slightly different pre-defined variable, depending on their location in Ready API, these are displayed on the top right of the script window, here is the Script Assertion window:
","images":{"__typename":"AssociatedImageConnection","edges":[{"__typename":"AssociatedImageEdge","cursor":"MjUuMnwyLjF8b3wyNXxfTlZffDE","node":{"__ref":"AssociatedImage:{\"url\":\"https://community.smartbear.com/t5/s/nwkab66374/images/bS0xMzIyNzAtMjcyOWlBRTM3RjE3MDgzRjFEQzJG?revision=1\"}"}}],"totalCount":1,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:132270_1"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}}},"ModerationData:moderation_data:132273":{"__typename":"ModerationData","id":"moderation_data:132273","status":"APPROVED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:132273":{"__typename":"ForumReplyMessage","uid":132273,"id":"message:132273","revisionNum":2,"author":{"__ref":"User:user:72908"},"readOnly":false,"repliesCount":2,"depth":2,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:readyapi-questions"},"parent":{"__ref":"ForumReplyMessage:message:132270"},"conversation":{"__ref":"Conversation:conversation:132262"},"subject":"Re: how to read Rawrequest using Script Assertion while using URI formats in the request ..","moderationData":{"__ref":"ModerationData:moderation_data:132273"},"body":"
As you says.. when i use \"getResponseContent() it reads the response and displayed.. i just swaped with \"getRequestContent()\".. Script Assertion is getting passed.. but i didnt get any info.. Take a look at the Screenshot
def requestXML = messageExchange.getRequestContent().toString()\nlog.info requestXML
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"213","kudosSumWeight":0,"postTime":"2016-12-06T01:39:58.760-08:00","lastPublishTime":"2016-12-06T01:43:50.050-08:00","metrics":{"__typename":"MessageMetrics","views":3503},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:ready_api_forums/community:nwkab66374board:readyapi-questions/message:132262/message:132273","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuMnwyLjF8b3wxfDE0OjAsMzk6MXwx","node":{"__ref":"AcceptedSolutionMessage:message:132278"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"editFrozen":false,"body@stringLength":"837","rawBody":"
As you says.. when i use \"getResponseContent() it reads the response and displayed.. i just swaped with \"getRequestContent()\".. Script Assertion is getting passed.. but i didnt get any info.. Take a look at the Screenshot
def requestXML = messageExchange.getRequestContent().toString()\nlog.info requestXML
Sorry, my mistake! I answered if it were a SOAP request, I believe you have a REST request? If so the messageExchange variable is of class RestResponseMessageExchange, I am not sure why the getRequestContent() method is empty (I'm guessing that it's because there is no \"content\" to your REST request, all the information is in the actual HTTP request)
The following code:
def rawRequest = new String(messageExchange.getRawRequestData(), \"UTF-8\")\nlog.info(rawRequest)
Seems to get what you may be after. The getRawRequestData() method returns a byte array, and then we use the String class constructor that takes a byte array argument to convert to a string (Not sure if there is a more \"Groovy\" way of doing this conversion).
Edit: Just wanted to point out that I have made the assumption that the raw request data is UTF-8 I haven't checked this.
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"218","kudosSumWeight":4,"repliesCount":1,"postTime":"2016-12-06T02:12:18.535-08:00","lastPublishTime":"2016-12-06T02:22:32.573-08:00","solution":true,"metrics":{"__typename":"MessageMetrics","views":3516},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"entityType":"FORUM_REPLY","eventPath":"category:ready_api_forums/community:nwkab66374board:readyapi-questions/message:132262/message:132278","customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"readOnly":false,"editFrozen":false,"body@stringLength":"1183","rawBody":"Sorry, my mistake! I answered if it were a SOAP request, I believe you have a REST request? If so the messageExchange variable is of class RestResponseMessageExchange, I am not sure why the getRequestContent() method is empty (I'm guessing that it's because there is no \"content\" to your REST request, all the information is in the actual HTTP request)
The following code:
def rawRequest = new String(messageExchange.getRawRequestData(), \"UTF-8\")\nlog.info(rawRequest)
Seems to get what you may be after. The getRawRequestData() method returns a byte array, and then we use the String class constructor that takes a byte array argument to convert to a string (Not sure if there is a more \"Groovy\" way of doing this conversion).
Edit: Just wanted to point out that I have made the assumption that the raw request data is UTF-8 I haven't checked this.
","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:132278_3"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}},"body@stripHtml({\"removeProcessingText\":true,\"removeSpoilerMarkup\":true,\"removeTocMarkup\":true,\"truncateLength\":200})@stringLength":"218","videos":{"__typename":"VideoConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"QueryVariables:MessageSolutions":{"__typename":"QueryVariables","id":"MessageSolutions","value":{"first":10,"constraints":{"topicId":{"eq":"message:132262"},"solution":{"eq":true}},"sorts":{"postTime":{"direction":"ASC"}},"useAvatar":true,"useAuthorLogin":true,"useAuthorRank":false,"useBody":true,"useKudosCount":false,"useTimeToRead":false,"useMedia":true,"useRepliesCount":false,"useSearchSnippet":false,"useAcceptedSolutionButton":true,"useSolvedBadge":false,"useAttachments":true,"useTags":false,"useUserHoverCard":false,"useNodeHoverCard":false,"usePreviewSubjectModal":false,"useMessageStatus":false}},"CachedAsset:text:en_US-components/messages/EscalatedMessageBanner-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/EscalatedMessageBanner-1741125846000","value":{"escalationMessage":"Escalated to Salesforce by {username} on {date}","viewDetails":"View Details","modalTitle":"Case Details","escalatedBy":"Escalated by: ","escalatedOn":"Escalated on: ","caseNumber":"Case Number: ","status":"Status: ","lastUpdateDate":"Last Update: ","automaticEscalation":"automatic escalation","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-components/users/UserLink-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/users/UserLink-1741125846000","value":{"authorName":"View Profile: {author}","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserRank-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserRank-1741125846000","value":{"rankName":"{rankName}","userRank":"Author rank {rankName}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageTime-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageTime-1741125846000","value":{"postTime":"Published: {time}","lastPublishTime":"Last Update: {time}","conversation.lastPostingActivityTime":"Last posting activity time: {time}","conversation.lastPostTime":"Last post time: {time}","moderationData.rejectTime":"Rejected time: {time}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolvedBadge-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolvedBadge-1741125846000","value":{"solved":"Solved"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSubject-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSubject-1741125846000","value":{"noSubject":"(no subject)"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageBody-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageBody-1741125846000","value":{"showMessageBody":"Show More","mentionsErrorTitle":"{mentionsType, select, board {Board} user {User} message {Message} other {}} No Longer Available","mentionsErrorMessage":"The {mentionsType} you are trying to view has been removed from the community.","videoProcessing":"Video is being processed. Please try again in a few minutes.","bannerTitle":"Video provider requires cookies to play the video. Accept to continue or {url} it directly on the provider's site.","buttonTitle":"Accept","urlText":"watch"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageCustomFields-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageCustomFields-1741125846000","value":{"CustomField.default.label":"Value of {name}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageReplyButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageReplyButton-1741125846000","value":{"repliesCount":"{count}","title":"Reply","title@board:BLOG@message:root":"Comment","title@board:TKB@message:root":"Comment","title@board:IDEA@message:root":"Comment","title@board:OCCASION@message:root":"Comment"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolutionList-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolutionList-1741125846000","value":{"emptyDescription":"No has been message solutions yet"},"localOverride":false},"CachedAsset:text:en_US-components/messages/AcceptedSolutionButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/AcceptedSolutionButton-1741125846000","value":{"accept":"Mark as Solution","accepted":"Marked as Solution","errorHeader":"Error!","errorAdd":"There was an error marking as solution.","errorRemove":"There was an error unmarking as solution.","solved":"Solved","topicAlreadySolvedErrorTitle":"Solution Already Exists","topicAlreadySolvedErrorDesc":"Refresh the browser to view the existing solution"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000","value":{"loadMore":"Show More"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageView/MessageViewInline-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageView/MessageViewInline-1741125846000","value":{"bylineAuthor":"{bylineAuthor}","bylineBoard":"{bylineBoard}","anonymous":"Anonymous","place":"Place {bylineBoard}","gotoParent":"Go to parent {name}"},"localOverride":false},"Revision:revision:132278_3":{"__typename":"Revision","id":"revision:132278_3","lastEditTime":"2016-12-06T02:22:32.573-08:00"},"AssociatedImage:{\"url\":\"https://community.smartbear.com/t5/s/nwkab66374/images/bS0xMzIyNzAtMjcyOWlBRTM3RjE3MDgzRjFEQzJG?revision=1\"}":{"__typename":"AssociatedImage","url":"https://community.smartbear.com/t5/s/nwkab66374/images/bS0xMzIyNzAtMjcyOWlBRTM3RjE3MDgzRjFEQzJG?revision=1","title":"ScriptAssertionWindow.png","associationType":"BODY","width":902,"height":478,"altText":null},"Revision:revision:132270_1":{"__typename":"Revision","id":"revision:132270_1","lastEditTime":"2016-12-06T01:27:29.524-08:00"},"AssociatedImage:{\"url\":\"https://community.smartbear.com/t5/s/nwkab66374/images/bS0xMzIyNzMtMjczM2k3NTFCNTVEMDhDM0EwQ0Qy?revision=2\"}":{"__typename":"AssociatedImage","url":"https://community.smartbear.com/t5/s/nwkab66374/images/bS0xMzIyNzMtMjczM2k3NTFCNTVEMDhDM0EwQ0Qy?revision=2","title":"Untitled.png","associationType":"BODY","width":618,"height":476,"altText":null},"Revision:revision:132273_2":{"__typename":"Revision","id":"revision:132273_2","lastEditTime":"2016-12-06T01:43:50.050-08:00"},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1741125846000","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"readyapi-questions","messageSubject":"how-to-read-rawrequest-using-script-assertion-while-using-uri-formats-in-the-req","messageId":"132262"},"buildId":"k2ra3WbQxEm0ebgjo41Oz","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","openTelemetryClientEnabled":false,"openTelemetryConfigName":"smartbear","openTelemetryServiceVersion":"25.2.0","openTelemetryUniverse":"prod","openTelemetryCollector":"http://localhost:4318","openTelemetryRouteChangeAllowedTime":"5000","apolloDevToolsEnabled":false,"inboxMuteWipFeatureEnabled":false},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["./components/seo/QAPageSchema/QAPageSchema.tsx","./components/community/Navbar/NavbarWidget.tsx","./components/community/Breadcrumb/BreadcrumbWidget.tsx","./components/messages/TopicWithThreadedReplyListWidget/TopicWithThreadedReplyListWidget.tsx","./components/messages/MessageListForNodeByRecentActivityWidget/MessageListForNodeByRecentActivityWidget.tsx","./components/messages/RelatedContentWidget/RelatedContentWidget.tsx","./components/customComponent/CustomComponent/CustomComponent.tsx","./components/messages/MessageView/MessageViewStandard/MessageViewStandard.tsx","./components/messages/ThreadedReplyList/ThreadedReplyList.tsx","../shared/client/components/common/List/UnstyledList/UnstyledList.tsx","./components/messages/MessageView/MessageView.tsx","../shared/client/components/common/Pager/PagerLoadMore/PagerLoadMore.tsx","./components/messages/MessageView/MessageViewInline/MessageViewInline.tsx","./components/customComponent/CustomComponentContent/TemplateContent.tsx"],"appGip":true,"scriptLoader":[]}