header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
January 09, 2009, 06:18:54 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
How to parse inline XML, encoded in Base64?
Welcome, Guest. Please login or register.
January 09, 2009, 06:18:54 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  How to parse inline XML, encoded in Base64?
« previous next »
Pages: [1] Print
Author Topic: How to parse inline XML, encoded in Base64?  (Read 361 times)
B
Newbie
*
Posts: 1


« on: July 22, 2008, 07:44:36 am »

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:

=====================================
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://www.example.com/">
        <ns1:SendSynRequest>
            <ns1:session>c0a83eda30d5ff54450fa0864f8da4efb1d2c3930f2b</ns1:session>
            <ns1:reportName>NIS_NM_esamiba</ns1:reportName>
            <ns1:XMLs>
                <ns1:XML>
                    <ns1:XMLname>NMR kodi:</ns1:XMLname>
                    <ns1:XMLvalue>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxOSVNfTk1fZXNhbWliYSB4
bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6
bm9OYW1lc3BhY2VTY2hlbWFMb2NhdGlvbj0iTklTX05NX2VzYW1pYmFfaW5wdXQueHNkIj4NCiAg
PG5vZG9rbHVfbWFrc2F0YWppPg0KICAgIDxub2Rva2x1X21ha3NhdGFqcz4NCiAgICAgIDxubXJf
a29kcz4wOTAxODAxMDYyMDwvbm1yX2tvZHM+DQogICAgPC9ub2Rva2x1X21ha3NhdGFqcz4NCiAg
ICA8bm9kb2tsdV9tYWtzYXRhanM+DQogICAgICA8bm1yX2tvZHM+MjYxMjMzMTA1MzE8L25tcl9r
b2RzPg0KICAgIDwvbm9kb2tsdV9tYWtzYXRhanM+DQogICAgPG5vZG9rbHVfbWFrc2F0YWpzPg0K
ICAgICAgPG5tcl9rb2RzPjE2MDQ3NDExMjg1PC9ubXJfa29kcz4NCiAgICA8L25vZG9rbHVfbWFr
c2F0YWpzPg0KICA8L25vZG9rbHVfbWFrc2F0YWppPg0KPC9OSVNfTk1fZXNhbWliYT4NCg==</ns1:XMLvalue>
                </ns1:XML>
            </ns1:XMLs>
        </ns1:SendSynRequest>
    </soap:Body>
</soap:Envelope>
======================================
//inline XML decoded:

<?xml version="1.0" encoding="UTF-8"?>
<NIS_NM_esamiba xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NIS_NM_esamiba_input.xsd">
  <nodoklu_maksataji>
    <nodoklu_maksatajs>
      <nmr_kods>09018010620</nmr_kods>
    </nodoklu_maksatajs>
    <nodoklu_maksatajs>
      <nmr_kods>26123310531</nmr_kods>
    </nodoklu_maksatajs>
    <nodoklu_maksatajs>
      <nmr_kods>16047411285</nmr_kods>
    </nodoklu_maksatajs>
  </nodoklu_maksataji>
</NIS_NM_esamiba>
-------------------------------------------------------



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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #1 on: July 22, 2008, 08:28:39 am »

Hi!

I think groovy has built-in decoding support, so if you have the base64 value you should be able to do something like

def value = ..get base64 value as string..
log.info( new String( value.decodeBase64()) )

does that help?

regards,

/Ole
eviware.com
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header