XML response escape characters

Hi @srepetop,

Welcome to the community!

This seems like an odd SOAP WebService, almost like it’s proxying XML payloads instead of representing an origin server. In any case, it looks like you’re doing everything correctly, as you’re getting a valid response. To get a cleaner-looking representation, one thing you can do is use the visualizer feature.

In the Tests tab of your request, include this code:

const template = `
<textarea style="width: 100%; height: 100%; font-family: monospace;" readonly>{{payload}}</textarea>
`;

const response = pm.response.text();
const $ = cheerio.load(response);
const xmlPayload = $('return').text();

pm.visualizer.set(template, {
    payload: xmlPayload
})

Then click the Visualize tab in the response body pane. You should see something like this:

EDIT: For extra credit, you can try to format the XML before displaying it so it’s a bit easier to navigate. That would look something like this:

const xml2js = require('xml2js');

const template = `
<textarea style="width: 100%; height: 100%; font-family: monospace;" readonly>{{payload}}</textarea>
`;

const response = pm.response.text();
const $ = cheerio.load(response);
const xmlPayload = $('return').text();

xml2js.parseString(xmlPayload, (_, res) => {
    const builder = new xml2js.Builder();
    const xml = builder.buildObject(res);

    pm.visualizer.set(template, {
        payload: xml
    });
});

Hope that helps!

Best,

Kevin