{"id":682,"date":"2020-02-09T10:41:51","date_gmt":"2020-02-09T15:41:51","guid":{"rendered":"https:\/\/richrijnders.com\/?p=682"},"modified":"2020-12-12T15:28:14","modified_gmt":"2020-12-12T20:28:14","slug":"iterate-through-soap-response-nodes-in-soapui-and-groovy","status":"publish","type":"post","link":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/","title":{"rendered":"Iterate Through Soap Response Nodes in soapUI and Groovy"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.3.1&#8243; custom_padding=&#8221;2px||2px|||&#8221;][et_pb_row column_structure=&#8221;3_5,2_5&#8243; _builder_version=&#8221;4.3.1&#8243; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_image src=&#8221;https:\/\/richrijnders.com\/file\/2020\/02\/soapui-logo.png&#8221; admin_label=&#8221;soapUI Logo&#8221; _builder_version=&#8221;4.7.6&#8243; hover_enabled=&#8221;0&#8243; alt=&#8221;soapUI-logo&#8221; title_text=&#8221;soapUI Logo&#8221; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_image src=&#8221;https:\/\/richrijnders.com\/file\/2020\/02\/apache-groovy-logo.png&#8221; admin_label=&#8221;Groovy Logo&#8221; _builder_version=&#8221;4.7.6&#8243; hover_enabled=&#8221;0&#8243; alt=&#8221;groovy-logo&#8221; title_text=&#8221;Apache Groovy Logo&#8221; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.3.1&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text admin_label=&#8221;Text 1&#8243; _builder_version=&#8221;4.3.1&#8243;]<\/p>\n<h2 style=\"text-align: center;\">SoapUI | Test Step | Groovy | Soap Response | List | Nodes | Iteration<\/h2>\n<p style=\"text-align: justify;\">Full confession: I am making another post out of frustration. Call it therapy. Why is it that quickly finding information or examples for seemingly simple things is sometimes so !@#$. For those not interested in the full rant, you can jump to the quick solution<a href=\"#solution\"> here<\/a>.<\/p>\n<p style=\"text-align: justify;\">First, let me say right off the bat that I love soapUI. It has become a defacto standard for running and testing api&#8217;s. I use it often to run stuff, test stuff, and check stuff. But, like most such utilities, it&#8217;s not the main thrust of my work so I don&#8217;t consider myself an expert in all the ins-and-outs of the tool and its capabilities. So, too, with the Apache Groovy language used by soapUI in its test cases. So when I get into the tool in order to solve a specific problem, I want to quickly find examples of what I need to do, modify them for my specific task, and use them. Maybe it&#8217;s because soapUI is such a versatile tool, or maybe because the typical soapUI user is already very technical but, often, finding clear examples of some very basic concepts is difficult.<\/p>\n<p style=\"text-align: justify;\">Recently, I found myself in the role of cat wrangler &#8211; er, &#8220;administrator&#8221; &#8211; of a host of IBM DataPower IDG devices that front end an army of API&#8217;s that are called thousands of times per second. Having grown organically over a number of years and innumerable developers, this system needed some some discipline applied to it. In my quest to document and understand the landscape of these devices and the deployed api&#8217;s, I needed a fast way to gather specific information from all the devices, document it, compare it, etc.<\/p>\n<p>&nbsp;<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;1_3,2_3&#8243; _builder_version=&#8221;4.3.1&#8243; custom_margin=&#8221;-51px|auto||auto||&#8221;][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_image src=&#8221;https:\/\/richrijnders.com\/file\/2020\/02\/ibm-amp-apis.png&#8221; _builder_version=&#8221;4.7.6&#8243; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243; alt=&#8221;soapUI-Panel-01&#8243; title_text=&#8221;IBM-AMP-APIs&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;2_3&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text _builder_version=&#8221;4.3.1&#8243;]<\/p>\n<p style=\"text-align: justify;\">IBM for years has provided a set of soap api&#8217;s that use AMP (Appliance Management Protocol) with the XML Management Interface on the IDG devices. It&#8217;s a full set of api&#8217;s that can usually get you the information you need. I have used them for years with soapUI. They are easy to import into a project and I normally just modify the soap request with the values I need, hit the &#8220;run&#8221; button, and get the soap response. It&#8217;s easy enough to scan the responses for the info you require. \u00a0But in this case, I didn&#8217;t want to look at soap responses. I wanted to query all the devices, parse the responses for the information, and output the information in a report or spreadsheet that I can use to document and analyze.<\/p>\n<p style=\"text-align: justify;\">I knew that soapUI has a great tool where you can create &#8220;Test Suites&#8221; that have &#8220;Test Cases&#8221; made up of &#8220;Test Steps&#8221; used to essentially automate running specific api&#8217;s and checking the results with &#8220;assertions&#8221; to determine pass or fail scenarios. That&#8217;s not really what I wanted to do, but I figured I could use the same facility to automate running these IBM api&#8217;s, then process and output the results with a Groovy script. The reason I decided to use Groovy has to do with having to loop through lists of servers, execute different api&#8217;s, use the results of some api&#8217;s to control logic and execute more api&#8217;s, etc. I will get into all that in another article, but if you landed on this page by doing a Google search for the keywords in the title, chances are good you have already come to the same decision on using a Groovy test step and probably for the same reasons.<\/p>\n<p style=\"text-align: justify;\">I had little problem setting up the Groovy script to dynamically hit a list of selected servers with my chosen api(s). I tented my fingers like an evil genius as I ran the script and watched as it executed each api call for each server and returned soap responses loaded with the information I required. Now all I had to do was parse each of those responses in turn and output the information in nice, neat little spreadsheet rows. Piece of cake, right?<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.3.1&#8243; min_height=&#8221;114px&#8221; custom_margin=&#8221;-24px|auto||auto||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text _builder_version=&#8221;4.3.1&#8243;]<\/p>\n<p style=\"text-align: justify;\">After each execution of an api, assigning the soap response to a &#8220;holder&#8221; object with the built in GroovyUtils library is pretty straight forward and it worked as expected. So the next step was to extract the list of nodes that I was interested in and output their various contents. But how?<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.3.1&#8243; custom_margin=&#8221;-24px|auto||auto||&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text admin_label=&#8221;Text 3&#8243; _builder_version=&#8221;4.3.1&#8243;]<\/p>\n<p style=\"text-align: justify;\">Well a quick web search should yeild some examples, no? No. At least none that solved my issue. An hour of searching various combinations of &#8220;soapUI&#8221;, &#8220;Groovy&#8221;, &#8220;iterate node list&#8221;, &#8220;loop through nodes&#8221; etc. kept bringing up the same top results, which were mostly message board posts with similar questions. If you found this article through similar searches, then you have already seen <em>this<\/em> ubiquitous &#8220;sample&#8221; code come up way too many times:<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_image src=&#8221;https:\/\/richrijnders.com\/file\/2020\/02\/soapui-bad-example.png&#8221; show_in_lightbox=&#8221;on&#8221; admin_label=&#8221;Bad Example&#8221; _builder_version=&#8221;4.7.6&#8243; custom_margin=&#8221;||3px|||&#8221; hover_enabled=&#8221;0&#8243; alt=&#8221;soapui-groovy-bad-example&#8221; title_text=&#8221;soapUI-bad-example&#8221; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.3.1&#8243; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p style=\"text-align: center;\">(click to enlarge)<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;3_5,2_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_dmb_code_snippet code=&#8221;PGVudjpFbnZlbG9wZSB4bWxuczplbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KICAgPGVudjpCb2R5PgogICAgICA8YW1wOkdldERvbWFpbkxpc3RSZXNwb25zZSB4bWxuczphbXA9Imh0dHA6Ly93d3cuZGF0YXBvd2VyLmNvbS9zY2hlbWFzL2FwcGxpYW5jZS9tYW5hZ2VtZW50LzMuMCI+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wMTwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzAyPC9hbXA6RG9tYWluPgogICAgICAgICA8YW1wOkRvbWFpbj5NWV9ET01BSU5fMDM8L2FtcDpEb21haW4+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wNDwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzA1PC9hbXA6RG9tYWluPgogICAgICAgICA8YW1wOkRvbWFpbj5NWV9ET01BSU5fMDY8L2FtcDpEb21haW4+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wNzwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzA4PC9hbXA6RG9tYWluPgogICAgICA8L2FtcDpHZXREb21haW5MaXN0UmVzcG9uc2U+CiAgIDwvZW52OkJvZHk+CjwvZW52OkVudmVsb3BlPg==&#8221; language=&#8221;xml&#8221; _builder_version=&#8221;4.3.1&#8243; body_font_size=&#8221;12px&#8221;]PGVudjpFbnZlbG9wZSB4bWxuczplbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KICAgPGVudjpCb2R5PgogICAgICA8YW1wOkdldERvbWFpbkxpc3RSZXNwb25zZSB4bWxuczphbXA9Imh0dHA6Ly93d3cuZGF0YXBvd2VyLmNvbS9zY2hlbWFzL2FwcGxpYW5jZS9tYW5hZ2VtZW50LzMuMCI+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wMTwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzAyPC9hbXA6RG9tYWluPgogICAgICAgICA8YW1wOkRvbWFpbj5NWV9ET01BSU5fMDM8L2FtcDpEb21haW4+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wNDwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzA1PC9hbXA6RG9tYWluPgogICAgICAgICA8YW1wOkRvbWFpbj5NWV9ET01BSU5fMDY8L2FtcDpEb21haW4+CiAgICAgICAgIDxhbXA6RG9tYWluPk1ZX0RPTUFJTl8wNzwvYW1wOkRvbWFpbj4KICAgICAgICAgPGFtcDpEb21haW4+TVlfRE9NQUlOXzA4PC9hbXA6RG9tYWluPgogICAgICA8L2FtcDpHZXREb21haW5MaXN0UmVzcG9uc2U+CiAgIDwvZW52OkJvZHk+CjwvZW52OkVudmVsb3BlPg==[\/et_pb_dmb_code_snippet][\/et_pb_column][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text _builder_version=&#8221;4.3.1&#8243; inline_fonts=&#8221;Courier Prime&#8221;]<\/p>\n<p style=\"text-align: justify;\">Now, I don&#8217;t want to criticize this code example too much. It&#8217;s fine for what it is and it probably isn&#8217;t the snippet creator&#8217;s fault that it has been quoted by others and reused in so many places. The problem is that it only works if your response structure is very simple &#8211; like with this <span style=\"font-family: 'Courier Prime';\">GetDomainList()<\/span> api that returns a simple list of domain names from a device. In this case, if you used that example and coded:<\/p>\n<p><span style=\"font-family: 'Courier Prime'; font-weight: normal;\"><strong>for( domain in holder.getNodeValues( &#8220;\/\/amp:Domain&#8221; ))<\/strong><\/span><\/p>\n<p style=\"text-align: justify;\">You would, indeed iterate through the list of domain elements, with the value of each domain element accessible in the loop variable &#8216;domain&#8217; each time through:<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.3.1&#8243; custom_margin=&#8221;-24px|auto||auto||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_dmb_code_snippet code=&#8221;ZGVmIGd1ID0gbmV3IGNvbS5ldml3YXJlLnNvYXB1aS5zdXBwb3J0Lkdyb292eVV0aWxzKCBjb250ZXh0ICk7CnJlc3BfR2V0RG9tYWluTGlzdCA9IGNvbnRleHQudGVzdENhc2UudGVzdFN1aXRlLnRlc3RDYXNlc1siUmVzb3VyY2VzIl0udGVzdFN0ZXBzWyJHZXREb21haW5MaXN0Il0udGVzdFJlcXVlc3QucmVzcG9uc2VDb250ZW50OwpyZXNwaGxkX0dldERvbWFpbkxpc3QgPSBndS5nZXRYbWxIb2xkZXIoIHJlc3BfR2V0RG9tYWluTGlzdCApOwpyZXNwaGxkX0dldERvbWFpbkxpc3QubmFtZXNwYWNlc1siYW1wIl0gPSAiaHR0cDovL3d3dy5kYXRhcG93ZXIuY29tL3NjaGVtYXMvYXBwbGlhbmNlL21hbmFnZW1lbnQvMy4wIjsKCmZvciAoIGVhY2hEb21haW4gaW4gcmVzcGhsZF9HZXREb21haW5MaXN0LmdldE5vZGVWYWx1ZXMoICIvL2FtcDpEb21haW4iICkgKSB7CgoJLy8gd2hhdCBpcyBpdD8gCglsb2cuaW5mbyggIiAgICAgQ2xhc3M6ICIgKyBlYWNoRG9tYWluLmdldENsYXNzKCkgKTsKCS8vIG91dHB1dDogIiAgICAgQ2xhc3M6IGNsYXNzLmphdmEubGFuZy5TdHJpbmciCgoJLy8gd2hhdCdzIGluIGl0PyAKCWxvZy5pbmZvKCAiICAgICBDb250ZW50OiAiICsgZWFjaERvbWFpbiApOwoJLy8gb3V0cHV0OiAiICAgIENvbnRlbnQ6IE15X0RPTUFJTl8wMDEiIGV0Yy4KCn0KCQo=&#8221; language=&#8221;groovy&#8221; _builder_version=&#8221;4.3.1&#8243; body_font_size=&#8221;12px&#8221;]ZGVmIGd1ID0gbmV3IGNvbS5ldml3YXJlLnNvYXB1aS5zdXBwb3J0Lkdyb292eVV0aWxzKCBjb250ZXh0ICk7CnJlc3BfR2V0RG9tYWluTGlzdCA9IGNvbnRleHQudGVzdENhc2UudGVzdFN1aXRlLnRlc3RDYXNlc1siUmVzb3VyY2VzIl0udGVzdFN0ZXBzWyJHZXREb21haW5MaXN0Il0udGVzdFJlcXVlc3QucmVzcG9uc2VDb250ZW50OwpyZXNwaGxkX0dldERvbWFpbkxpc3QgPSBndS5nZXRYbWxIb2xkZXIoIHJlc3BfR2V0RG9tYWluTGlzdCApOwpyZXNwaGxkX0dldERvbWFpbkxpc3QubmFtZXNwYWNlc1siYW1wIl0gPSAiaHR0cDovL3d3dy5kYXRhcG93ZXIuY29tL3NjaGVtYXMvYXBwbGlhbmNlL21hbmFnZW1lbnQvMy4wIjsKCmZvciAoIGVhY2hEb21haW4gaW4gcmVzcGhsZF9HZXREb21haW5MaXN0LmdldE5vZGVWYWx1ZXMoICIvL2FtcDpEb21haW4iICkgKSB7CgoJLy8gd2hhdCBpcyBpdD8gCglsb2cuaW5mbyggIiAgICAgQ2xhc3M6ICIgKyBlYWNoRG9tYWluLmdldENsYXNzKCkgKTsKCS8vIG91dHB1dDogIiAgICAgQ2xhc3M6IGNsYXNzLmphdmEubGFuZy5TdHJpbmciCgoJLy8gd2hhdCdzIGluIGl0PyAKCWxvZy5pbmZvKCAiICAgICBDb250ZW50OiAiICsgZWFjaERvbWFpbiApOwoJLy8gb3V0cHV0OiAiICAgIENvbnRlbnQ6IE15X0RPTUFJTl8wMDEiIGV0Yy4KCn0KCQo=[\/et_pb_dmb_code_snippet][et_pb_text _builder_version=&#8221;4.3.1&#8243; custom_padding=&#8221;1px|||||&#8221; inline_fonts=&#8221;Courier Prime&#8221;]<\/p>\n<p style=\"text-align: justify;\">But what happens when your SOAP response is not so simple? \u00a0Take this response to the <span style=\"font-family: 'Courier Prime'; font-weight: normal;\">GetServiceListFromDomain()<\/span> api, for example:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;PGVudjpFbnZlbG9wZSB4bWxuczplbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KICAgPGVudjpCb2R5PgogICAgICA8YW1wOkdldFNlcnZpY2VMaXN0RnJvbURvbWFpblJlc3BvbnNlIHhtbG5zOmFtcD0iaHR0cDovL3d3dy5kYXRhcG93ZXIuY29tL3NjaGVtYXMvYXBwbGlhbmNlL21hbmFnZW1lbnQvMy4wIj4KICAgICAgICAgPGFtcDpTZXJ2aWNlcz4KICAgICAgICAgICAgPGFtcDpPYmplY3QgbmFtZT0ibXlBUElfMDAxIiBjbGFzcy1uYW1lPSJNdWx0aVByb3RvY29sR2F0ZXdheSIgY2xhc3MtZGlzcGxheS1uYW1lPSJNdWx0aS1Qcm90b2NvbCBHYXRld2F5Ij4KICAgICAgICAgICAgICAgPGFtcDpVc2VyQ29tbWVudHM+TXkgQXdlc29tZSBNUEdXPC9hbXA6VXNlckNvbW1lbnRzPgogICAgICAgICAgICAgICA8YW1wOkFkbWluU3RhdGU+ZW5hYmxlZDwvYW1wOkFkbWluU3RhdGU+CiAgICAgICAgICAgICAgIDxhbXA6T3BTdGF0ZT51cDwvYW1wOk9wU3RhdGU+CiAgICAgICAgICAgICAgIDxhbXA6Q29uZmlnU3RhdGU+c2F2ZWQ8L2FtcDpDb25maWdTdGF0ZT4KICAgICAgICAgICAgICAgPGFtcDpRdWllc2NlU3RhdGUvPgogICAgICAgICAgICA8L2FtcDpPYmplY3Q+CiAgICAgICAgICAgIDxhbXA6T2JqZWN0IG5hbWU9Im15QVBJXzAwMiIgY2xhc3MtbmFtZT0iWE1MRmlyZXdhbGxTZXJ2aWNlIiBjbGFzcy1kaXNwbGF5LW5hbWU9IlhNTCBGaXJld2FsbCBTZXJ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ZWxvcGU+&#8221; language=&#8221;groovy&#8221; _builder_version=&#8221;4.3.1&#8243; body_font_size=&#8221;12px&#8221;]PGVudjpFbnZlbG9wZSB4bWxuczplbnY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj4KICAgPGVudjpCb2R5PgogICAgICA8YW1wOkdldFNlcnZpY2VMaXN0RnJvbURvbWFpblJlc3BvbnNlIHhtbG5zOmFtcD0iaHR0cDovL3d3dy5kYXRhcG93ZXIuY29tL3NjaGVtYXMvYXBwbGlhbmNlL21hbmFnZW1lbnQvMy4wIj4KICAgICAgICAgPGFtcDpTZXJ2aWNlcz4KICAgICAgICAgICAgPGFtcDpPYmplY3QgbmFtZT0ibXlBUElfMDAxIiBjbGFzcy1uYW1lPSJNdWx0aVByb3RvY29sR2F0ZXdheSIgY2xhc3MtZGlzcGxheS1uYW1lPSJNdWx0aS1Qcm90b2NvbCBHYXRld2F5Ij4KICAgICAgICAgICAgICAgPGFtcDpVc2VyQ29tbWVudHM+TXkgQXdlc29tZSBNUEdXPC9hbXA6VXNlckNvbW1lbnRzPgogICAgICAgICAgICAgICA8YW1wOkFkbWluU3RhdGU+ZW5hYmxlZDwvYW1wOkFkbWluU3RhdGU+CiAgICAgICAgICAgICAgIDxhbXA6T3BTdGF0ZT51cDwvYW1wOk9wU3RhdGU+CiAgICAgICAgICAgICAgIDxhbXA6Q29uZmlnU3RhdGU+c2F2ZWQ8L2FtcDpDb25maWdTdGF0ZT4KICAgICAgICAgICAgICAgPGFtcDpRdWllc2NlU3RhdGUvPgogICAgICAgICAgICA8L2FtcDpPYmplY3Q+CiAgICAgICAgICAgIDxhbXA6T2JqZWN0IG5hbWU9Im15QVBJXzAwMiIgY2xhc3MtbmFtZT0iWE1MRmlyZXdhbGxTZXJ2aWNlIiBjbGFzcy1kaXNwbGF5LW5hbWU9IlhNTCBGaXJld2FsbCBTZXJ2aWNlIj4KICAgICAgICAgICAgICAgPGFtcDpVc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builder_version=&#8221;4.3.1&#8243;]<\/p>\n<p style=\"text-align: justify;\">If you need to iterate through the list of &#8220;Object&#8221; nodes and retrieve the values of the attributes and sub-nodes, using the same code example does not work:<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;ZGVmIGd1ID0gbmV3IGNvbS5ldml3YXJlLnNvYXB1aS5zdXBwb3J0Lkdyb292eVV0aWxzKCBjb250ZXh0ICk7CnJlc3BfR2V0U2VydmljZUxpc3RGcm9tRG9tYWluID0gY29udGV4dC50ZXN0Q2FzZS50ZXN0U3VpdGUudGVzdENhc2VzWyJSZXNvdXJjZXMiXS50ZXN0U3RlcHNbIkdldFNlcnZpY2VMaXN0RnJvbURvbWFpbiJdLnRlc3RSZXF1ZXN0LnJlc3BvbnNlQ29udGVudDsKcmVzcGhsZF9HZXRTZXJ2aWNlTGlzdEZyb21Eb21haW4gPSBndS5nZXRYbWxIb2xkZXIoIHJlc3BfR2V0U2VydmljZUxpc3RGcm9tRG9tYWluICk7CnJlc3BobGRfR2V0U2VydmljZUxpc3RGcm9tRG9tYWluLm5hbWVzcGFjZXNbImFtcCJdID0gImh0dHA6Ly93d3cuZGF0YXBvd2VyLmNvbS9zY2hlbWFzL2FwcGxpYW5jZS9tYW5hZ2VtZW50LzMuMCI7Cgpmb3IgKCBlYWNoT2JqIGluIHJlc3BobGRfR2V0U2VydmljZUxpc3RGcm9tRG9tYWluLmdldE5vZGVWYWx1ZXMoICIvL2FtcDpPYmplY3QiICkgKSB7CgoJLy8gd2hhdCBpcyBpdD8gCglsb2cuaW5mbyggIiAgICAgQ2xhc3M6ICIgKyBlYWNoT2JqLmdldENsYXNzKCkgKTsKCS8vIG91dHB1dDogIiAgICAgQ2xhc3M6IGNsYXNzLmphdmEubGFuZy5TdHJpbmciCgoJLy8gd2hhdCdzIGluIGl0PyAKCWxvZy5pbmZvKCAiICAgICBDb250ZW50OiAiICsgZWFjaE9iaiApOwoJLy8gb3V0cHV0OiAiICAgIENvbnRlbnQ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et_pb_dmb_code_snippet][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.3.1&#8243; custom_padding=&#8221;11px|||||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text module_id=&#8221;solution&#8221; _builder_version=&#8221;4.3.1&#8243; inline_fonts=&#8221;Courier Prime&#8221;]<\/p>\n<p style=\"text-align: justify;\">It&#8217;s clear from the results above that <span face=\"courier\" style=\"font-family: courier;\">getNodeValues()<\/span> will only return a list of strings &#8211; not a list of nodes with sub-nodes, elements, and attributes. Since the &#8220;Object&#8221; nodes in the soap result have no values (only attributes, sub nodes, and elements) <span face=\"courier\" style=\"font-family: 'Courier Prime'; font-weight: normal;\">getNodeValues()<\/span>\u00a0returns\u00a0only a list of empty strings. So how are we to iterate over the &#8220;Object&#8221; nodes and retrieve the attributes and values of each?<\/p>\n<p style=\"text-align: justify;\">The solution is to only use <span face=\"courier\" style=\"font-family: courier;\">getNodeValues()<\/span> in order to find out how many nodes were returned in the soap response. Then, we will loop that many times through our response object and access each of the attributes and values directly using a loop counter as an index value in the xPath. The below example is based on the same <span style=\"font-family: 'Courier Prime'; font-weight: normal;\">GetServiceListFromDomain()<\/span> api response illustrated above. Note that inside our loop we are using <span face=\"courier\" style=\"font-family: courier;\">getNodeValue()<\/span> and not <span face=\"courier\" style=\"font-family: courier;\">getNodeValue<strong>s<\/strong>()<\/span> in order to return a single string value rather than a list of string values.<\/p>\n<p>[\/et_pb_text][et_pb_dmb_code_snippet code=&#8221;ZGVmIGd1ID0gbmV3IGNvbS5ldml3YXJlLnNvYXB1aS5zdXBwb3J0Lkdyb292eVV0aWxzKCBjb250ZXh0ICk7CnJlc3BfR2V0U2VydmljZUxpc3RGcm9tRG9tYWluID0gY29udGV4dC50ZXN0Q2FzZS50ZXN0U3VpdGUudGVzdENhc2VzWyJSZXNvdXJjZXMiXS50ZXN0U3RlcHNbIkdldFNlcnZpY2VMaXN0RnJvbURvbWFpbiJd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4uZ2V0Tm9kZVZhbHVlKCAiLy9hbXA6T2JqZWN0WyRpXS9AbmFtZSIgKTsKCWRlZiBvYmpUeXBlID0gcmVzcGhsZF9HZXRTZXJ2aWNlTGlzdEZyb21Eb21haW4uZ2V0Tm9kZVZhbHVlKCAiLy9hbXA6T2JqZWN0WyRpXS9AY2xhc3MtZGlzcGxheS1uYW1lIiApOwoKCS8vIFRoZXNlIHR3byBhcmUgZ29vZCBleGFwbGVzIG9mIGFjY2Vzc2luZyBzdWIgZWxlbWVudHMgb2YgdGhlIG5vZGUKCWRlZiBvYmpEZXNjID0gcmVzcGhsZF9HZXRTZXJ2aWNlTGlzdEZyb21Eb21haW4uZ2V0Tm9kZVZhbHVlKCAiLy9hbXA6T2JqZWN0WyRpXS9hbXA6VXNlckNvbW1lbnRzIiApOwoJZGVmIG9ialN0YXRlID0gcmVzcGhsZF9HZXRTZXJ2aWNlTGlzdEZyb21Eb21haW4uZ2V0Tm9kZVZhbHVlKCAiLy9hbXA6T2JqZWN0WyRpXS9hbXA6QWRtaW5TdGF0ZSIgKTsKCglsb2cuaW5mbyggIiAgICBPYmo6ICRvYmpOYW1lIHwgJG9ialR5cGUgIHwgJG9iakRlc2MgIHwgJG9ialN0YXRlICAiICk7Cgp9Cg==[\/et_pb_dmb_code_snippet][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.3.1&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.3.1&#8243;][et_pb_text _builder_version=&#8221;4.3.1&#8243;]<\/p>\n<p style=\"text-align: justify;\">Well, there you have it. Born out of my frustration of going down a rabbit hole of web searches looking for a simple way to iterate over list of results nodes and extract attributes and values from sub elements, I give you this little code snippet. \u00a0For those of you who read through the entire rant, thanks for sticking with me! For those of you who jumped straight to the solution, no worries. If you came here through the same rabbit hole of web searches that I went through, I understand. \u00a0If you can, post some backlinks to this article on some of the message boards where you see similar questions, or maybe even on your own blogs . Maybe we can get this solution bumped a bit higher up the web search results and save some fellow developers the same frustration in the future.<\/p>\n<p style=\"text-align: justify;\">If you would like more information or examples about how I am using Groovy code inside soapUI Test Suites, Test Cases, and Test Steps to generate output in the form of Excel spreadsheets, leave me a comment and I will get around to making that series of tutorials.<\/p>\n<p style=\"text-align: justify;\">Happy Coding!<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Iterate over a list of nodes in soap results using soapUI and Groovy.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[28],"tags":[33,37,32,38,36,39],"class_list":["post-682","post","type-post","status-publish","format-standard","hentry","category-rich-rijnders-code-snippets","tag-code","tag-groovy","tag-script","tag-soap","tag-soapui","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders<\/title>\n<meta name=\"description\" content=\"Because I couldn&#039;t find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders\" \/>\n<meta property=\"og:description\" content=\"Because I couldn&#039;t find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/\" \/>\n<meta property=\"og:site_name\" content=\"Rich Rijnders\" \/>\n<meta property=\"article:published_time\" content=\"2020-02-09T15:41:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-12T20:28:14+00:00\" \/>\n<meta name=\"author\" content=\"rich\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rich\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/\"},\"author\":{\"name\":\"rich\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/#\\\/schema\\\/person\\\/186c2ab9e139d2ed4065ce4a70046eff\"},\"headline\":\"Iterate Through Soap Response Nodes in soapUI and Groovy\",\"datePublished\":\"2020-02-09T15:41:51+00:00\",\"dateModified\":\"2020-12-12T20:28:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/\"},\"wordCount\":3554,\"commentCount\":0,\"keywords\":[\"code\",\"Groovy\",\"script\",\"soap\",\"soapui\",\"xml\"],\"articleSection\":[\"Code Snippets\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/\",\"url\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/\",\"name\":\"Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/richrijnders.com\\\/#website\"},\"datePublished\":\"2020-02-09T15:41:51+00:00\",\"dateModified\":\"2020-12-12T20:28:14+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/richrijnders.com\\\/#\\\/schema\\\/person\\\/186c2ab9e139d2ed4065ce4a70046eff\"},\"description\":\"Because I couldn't find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/iterate-through-soap-response-nodes-in-soapui-and-groovy\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/richrijnders.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Iterate Through Soap Response Nodes in soapUI and Groovy\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/#website\",\"url\":\"https:\\\/\\\/richrijnders.com\\\/\",\"name\":\"Rich Rijnders\",\"description\":\"Cloud and SOA Integration Architect\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/richrijnders.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/richrijnders.com\\\/#\\\/schema\\\/person\\\/186c2ab9e139d2ed4065ce4a70046eff\",\"name\":\"rich\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g\",\"caption\":\"rich\"},\"url\":\"https:\\\/\\\/richrijnders.com\\\/profile\\\/rich\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders","description":"Because I couldn't find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/","og_locale":"en_US","og_type":"article","og_title":"Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders","og_description":"Because I couldn't find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.","og_url":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/","og_site_name":"Rich Rijnders","article_published_time":"2020-02-09T15:41:51+00:00","article_modified_time":"2020-12-12T20:28:14+00:00","author":"rich","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rich","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/#article","isPartOf":{"@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/"},"author":{"name":"rich","@id":"https:\/\/richrijnders.com\/#\/schema\/person\/186c2ab9e139d2ed4065ce4a70046eff"},"headline":"Iterate Through Soap Response Nodes in soapUI and Groovy","datePublished":"2020-02-09T15:41:51+00:00","dateModified":"2020-12-12T20:28:14+00:00","mainEntityOfPage":{"@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/"},"wordCount":3554,"commentCount":0,"keywords":["code","Groovy","script","soap","soapui","xml"],"articleSection":["Code Snippets"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/","url":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/","name":"Iterate Through Soap Response Nodes in soapUI and Groovy - Rich Rijnders","isPartOf":{"@id":"https:\/\/richrijnders.com\/#website"},"datePublished":"2020-02-09T15:41:51+00:00","dateModified":"2020-12-12T20:28:14+00:00","author":{"@id":"https:\/\/richrijnders.com\/#\/schema\/person\/186c2ab9e139d2ed4065ce4a70046eff"},"description":"Because I couldn't find the solution in my own web searches, here is how to iterate through a list of nodes in a soap response using soapUI and Groovy.","breadcrumb":{"@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/richrijnders.com\/iterate-through-soap-response-nodes-in-soapui-and-groovy\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/richrijnders.com\/"},{"@type":"ListItem","position":2,"name":"Iterate Through Soap Response Nodes in soapUI and Groovy"}]},{"@type":"WebSite","@id":"https:\/\/richrijnders.com\/#website","url":"https:\/\/richrijnders.com\/","name":"Rich Rijnders","description":"Cloud and SOA Integration Architect","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/richrijnders.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/richrijnders.com\/#\/schema\/person\/186c2ab9e139d2ed4065ce4a70046eff","name":"rich","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6bb4ab7390db5599ceab3677366582dcfc4110c702347142e2a71510ad6f2877?s=96&d=mm&r=g","caption":"rich"},"url":"https:\/\/richrijnders.com\/profile\/rich\/"}]}},"_links":{"self":[{"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/posts\/682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/comments?post=682"}],"version-history":[{"count":3,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/posts\/682\/revisions"}],"predecessor-version":[{"id":780,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/posts\/682\/revisions\/780"}],"wp:attachment":[{"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/media?parent=682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/categories?post=682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/richrijnders.com\/rest\/wp\/v2\/tags?post=682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}