Extract XML-output (from API-request) to multible tables

If you think that something doesn't work in Aware IM post your message here
Post Reply
jannes
Posts: 106
Joined: Tue Jul 02, 2019 12:22 pm

Extract XML-output (from API-request) to multible tables

Post by jannes »

I'm using a REST call to retrieve the XML-response from
https://soap.e-boekhouden.nl/soap.asmx? ... rekeningen

The tables are created using : https://soap.e-boekhouden.nl/soap.asmx?WSDL

The XML-response is like :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetGrootboekrekeningenResponse xmlns="http://www.e-boekhouden.nl/soap">
<GetGrootboekrekeningenResult>
<ErrorMsg />
<Rekeningen>
<cGrootboekrekening>
<ID>34318076</ID>
<Code>1410</Code>
<Omschrijving>Privé-opnamen en stortingen</Omschrijving>
<Categorie>BAL</Categorie>
<Groep />
</cGrootboekrekening>
<cGrootboekrekening>
<ID>34318081</ID>
<Code>0130</Code>
<Omschrijving>Inventarissen</Omschrijving>
<Categorie>BAL</Categorie>
<Groep />
</cGrootboekrekening>
</Rekeningen>
</GetGrootboekrekeningenResult>
</GetGrootboekrekeningenResponse>
</soap:Body>
</soap:Envelope>

There are 4 "levels" :

GetGrootboekrekeningenResponse (1)
- GetGrootboekrekeningenResult (2)
- ErrorMsg
- Rekeningen (3)
- cGrootboekrekening (4)
- Categorie
- Code
- Groep
- ID
- Omschrijving

After a request the XML-response is NOT stored in the 4 underlying tables.

Questions :
- Should it work if there are 4 levels ?
- Otherwise, how to extract a single field with XML-response to tables ?
- Is it possible to use PARSE_XML (object, '//string') to extract data from an array ?
- Do I have to write an external (Python) program to extract the XML-response ?
BobK
Posts: 559
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Extract XML-output (from API-request) to multible tables

Post by BobK »

What version of AwareIM are you using?
Bob
nhofkes
Posts: 129
Joined: Mon Sep 07, 2020 6:03 am
Location: Netherlands

Re: Extract XML-output (from API-request) to multible tables

Post by nhofkes »

Hi Jannes,

Perhaps there is an easier way, but if you can store the XML response in a text attribute, you can always retrieve any value using PARSE_XML with the correct XPath expression, no matter how many levels deep.
Niels
(V9.0 build 3272 - MariaDB - Windows)
Post Reply