Forum Discussion

mikkelsen's avatar
mikkelsen
Visitor
7 years ago

SoapUI REST MockService: Send static binary data as application/zip

Hello,

 

I am trying to create a SoapUI REST mock service that responds with a number of headers and a zip file. The content will be static. 

 

I have tried to paste the content of the zip file directly into the mock servcie response window (see attachment), both as binary and as base 64, but when I access the mock in Chrome, the resulting zip file is corrupt.

 

Any ideas on how to solve this?

 

Cheers,

Troels

1 Reply

  • oislas's avatar
    oislas
    New Contributor

    That occurs almost always with any type of file, for a PDF by example, I couldn't return other thing than a Minimal Concept PDF that I type in the editor window as:

     

    %PDF-1.1
    %¥±ë

    1 0 obj
    << /Type /Catalog
    /Pages 2 0 R
    >>
    endobj

    2 0 obj
    << /Type /Pages
    /Kids [3 0 R]
    /Count 1
    /MediaBox [0 0 300 144]
    >>
    endobj

    3 0 obj
    << /Type /Page
    /Parent 2 0 R
    /Resources
    << /Font
    << /F1
    << /Type /Font
    /Subtype /Type1
    /BaseFont /Times-Roman
    >>
    >>
    >>
    /Contents 4 0 R
    >>
    endobj

    4 0 obj
    << /Length 55 >>
    stream
    BT
    /F1 18 Tf
    0 0 Td
    (Estado Cta.) Tj
    ET
    endstream
    endobj

    xref
    0 5
    0000000000 65535 f
    0000000018 00000 n
    0000000077 00000 n
    0000000178 00000 n
    0000000457 00000 n
    trailer
    << /Root 1 0 R
    /Size 5
    >>
    startxref
    565
    %%EOF

     

    I think that SoapUI always convert this string o any other string into a Base64 string when de mock service response, as you can notice, the Minimal PDF encoding have not special characters.