17 years ago
How to parse inline XML, encoded in Base64?
Hi!
I have to test response XML which contains normal data and also another XML encoded in Base64. This inline XML contains data I have to check.
For example, I receive:
=====================================
c0a83eda30d5ff54450fa0864f8da4efb1d2c3930f2b
NIS_NM_esamiba
NMR kodi:
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxOSVNfTk1fZXNhbWliYSB4
bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6
bm9OYW1lc3BhY2VTY2hlbWFMb2NhdGlvbj0iTklTX05NX2VzYW1pYmFfaW5wdXQueHNkIj4NCiAg
PG5vZG9rbHVfbWFrc2F0YWppPg0KICAgIDxub2Rva2x1X21ha3NhdGFqcz4NCiAgICAgIDxubXJf
a29kcz4wOTAxODAxMDYyMDwvbm1yX2tvZHM+DQogICAgPC9ub2Rva2x1X21ha3NhdGFqcz4NCiAg
ICA8bm9kb2tsdV9tYWtzYXRhanM+DQogICAgICA8bm1yX2tvZHM+MjYxMjMzMTA1MzE8L25tcl9r
b2RzPg0KICAgIDwvbm9kb2tsdV9tYWtzYXRhanM+DQogICAgPG5vZG9rbHVfbWFrc2F0YWpzPg0K
ICAgICAgPG5tcl9rb2RzPjE2MDQ3NDExMjg1PC9ubXJfa29kcz4NCiAgICA8L25vZG9rbHVfbWFr
c2F0YWpzPg0KICA8L25vZG9rbHVfbWFrc2F0YWppPg0KPC9OSVNfTk1fZXNhbWliYT4NCg==
======================================
//inline XML decoded:
09018010620
26123310531
16047411285
-------------------------------------------------------
I can easily check if session (or XMLname or reportName) match expected values, but I can't figure out how to check value of nmr_kods which is in encoded XML (here ir simple decoder http://www.hcidata.info/base64.htm ).
I've tried to write Groovy script and I managed to get value in Base64, but i failed to decode and parse it.
Thanks in advance, hope this topic will be useful for people in the future.
Best regards,
Jevgenijs
I have to test response XML which contains normal data and also another XML encoded in Base64. This inline XML contains data I have to check.
For example, I receive:
=====================================
bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6
bm9OYW1lc3BhY2VTY2hlbWFMb2NhdGlvbj0iTklTX05NX2VzYW1pYmFfaW5wdXQueHNkIj4NCiAg
PG5vZG9rbHVfbWFrc2F0YWppPg0KICAgIDxub2Rva2x1X21ha3NhdGFqcz4NCiAgICAgIDxubXJf
a29kcz4wOTAxODAxMDYyMDwvbm1yX2tvZHM+DQogICAgPC9ub2Rva2x1X21ha3NhdGFqcz4NCiAg
ICA8bm9kb2tsdV9tYWtzYXRhanM+DQogICAgICA8bm1yX2tvZHM+MjYxMjMzMTA1MzE8L25tcl9r
b2RzPg0KICAgIDwvbm9kb2tsdV9tYWtzYXRhanM+DQogICAgPG5vZG9rbHVfbWFrc2F0YWpzPg0K
ICAgICAgPG5tcl9rb2RzPjE2MDQ3NDExMjg1PC9ubXJfa29kcz4NCiAgICA8L25vZG9rbHVfbWFr
c2F0YWpzPg0KICA8L25vZG9rbHVfbWFrc2F0YWppPg0KPC9OSVNfTk1fZXNhbWliYT4NCg==
======================================
//inline XML decoded:
-------------------------------------------------------
I can easily check if session (or XMLname or reportName) match expected values, but I can't figure out how to check value of nmr_kods which is in encoded XML (here ir simple decoder http://www.hcidata.info/base64.htm ).
I've tried to write Groovy script and I managed to get value in Base64, but i failed to decode and parse it.
Thanks in advance, hope this topic will be useful for people in the future.
Best regards,
Jevgenijs