Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
therealdees
Creator III
Creator III

Help parsing XML Response

Hi,

I'm having trouble trying to parse a XML SOAP response in Qlik, using the REST connector and hoping someone could help me out.

I'm not very experienced in the subject, but I've managed to get the response. The problem is that it comes in a single field and I don't know how parse it as a table.

1. I've set the body and header in the REST connector, and added the wsdl as the URL request. If I click "test connection" it says "succeeded".

2. If I click on the "select data" button in the connector, it opens the preview table, but it automatically is read as a CSV. If I change the option to XML, only the headers will show in the preview (no data is retrieved), while the CSV will show the actual response data encapsulated in a single cell.

therealdees_0-1715700569654.png

(if I hover the value I see the same response I get in postman, which is correct)

 

therealdees_1-1715700607338.png

(XML doesn't return values, but only these columns)

 

How can I display this response as table in Qlik?

therealdees_2-1715700923039.png

 

 

PS: I've noticed the response I get carries "&lt;" and "&gt;" which I found out to be the "<>" chars. Not sure if it's relevant.

 

Labels (5)
5 Replies
lind_oliveira20
Partner - Contributor II
Partner - Contributor II

In the REST connection you must place the following content in the Query headers:
Name: Content-Type
Value: text/xml; charset=utf-8

lind_oliveira20_0-1715709490818.png

 

Then just test the connection and save.

The next step is to click on select data and select the last XML tag.

lind_oliveira20_1-1715709516767.png

 

The API used in the test returns the name of the list of countries

Enpoint api: http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso

Request Body:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<ListOfCountryNamesByName xmlns="http://www.oorsprong.org/websamples.countryinfo">
</ListOfCountryNamesByName>
</soap12:Body>
</soap12:Envelope>

Query headers: Name: Content-Type: Value: text/xml; charset=utf-8

therealdees
Creator III
Creator III
Author

Hi!

Thanks for the reply.

 

As for the headers, I had exactly that, but still it doesn't work.

 

I tested the API you provided for the list of countries, and funny thing is that it happens the same!

What am I missing?

 

I did exactly that. Then went to "select data" and it automatically recognizes it as a CSV file. If I change the response type to XML it gives me the same structure (which relates to the SOAP config columns I guess):

therealdees_0-1715718811731.png

 

This is the setup I've used with the example you provided:

therealdees_1-1715718874848.png

 

therealdees_2-1715718897574.png

 

therealdees_3-1715718929777.pngtherealdees_4-1715718954713.png

 

therealdees
Creator III
Creator III
Author

Actually, I just realized that the "menu" in the "select data" can be expanded from Envelope > Body > etc.

The API you provided as an example did work and gave me a table with the data, but the one I'm using gives me no results (only if I identify the data as a CSV, then it gives me a column with the raw response in a single field as mentioned before)

 

therealdees_0-1715719931626.png

 

therealdees
Creator III
Creator III
Author

I'm almost convinced that it has to do with the response structure that is not properly parsed in tags and therefore not recognized by Qlik.

If I call the API you provided in Postman, I get a nice structured response, differently from the API I'm trying to consume:

therealdees_0-1715723434527.png

therealdees_1-1715723484136.png

 

lind_oliveira20
Partner - Contributor II
Partner - Contributor II

I once went through a similar problem, I solved it by generating an XML file of the response and dragging it to qlik in the data manager, qlik generated the script automatically and then I copied the script and processed it as I needed, I suggest you do this test.