diff --git a/src/stuf/stuf_bg/constants.py b/src/stuf/stuf_bg/constants.py index bcc129a1b3..cf45665554 100644 --- a/src/stuf/stuf_bg/constants.py +++ b/src/stuf/stuf_bg/constants.py @@ -5,7 +5,8 @@ # Note: This could cause a collision if two of the same elements # are present in different namespaces NAMESPACE_REPLACEMENTS = { - "http://schemas.xmlsoap.org/soap/envelope/": None, + "http://www.w3.org/2003/05/soap-envelope": None, # SOAP 1.2 + "http://schemas.xmlsoap.org/soap/envelope/": None, # SOAP 1.1 "http://www.egem.nl/StUF/sector/bg/0310": None, "http://www.egem.nl/StUF/StUF0301": None, "http://www.w3.org/1999/xlink": None, diff --git a/src/stuf/stuf_bg/tests/test_client.py b/src/stuf/stuf_bg/tests/test_client.py index 592b7389a6..3310d9b6a3 100644 --- a/src/stuf/stuf_bg/tests/test_client.py +++ b/src/stuf/stuf_bg/tests/test_client.py @@ -254,6 +254,64 @@ def test_inp_heeftAlsKinderen(self): value = glom(data_dict, GlomTarget["inp.heeftAlsKinderen"], default=missing) self.assertNotEqual(value, missing) + @tag("gh-4338") + @requests_mock.Mocker() + def test_scattered_namespaces(self, m): + XML = b""" + + + + + + La01 + + + CGS + + + + + Maykin + OpenForms + + + + S17170448031 + 2024053011095409 + 6551d7e5-515c-4c30-b249-e8aab590ac06 + NPS + + + false + + + + 111222333 + Janssen + + 19820304 + + + + + + """ + m.post(self.stuf_service.soap_service.url, content=XML) + + response_data = self.stufbg_client.get_values("999992314", ["irrelevant"]) + + expected = { + "inp.bsn": "111222333", + "geslachtsnaam": "Janssen", + "voorvoegselGeslachtsnaam": None, + "geboortedatum": "19820304", + } + for key, value in expected.items(): + with self.subTest(key=key, value=value): + self.assertEqual(response_data.get(key), value) + def _contains_nils(d: dict): """Check if xmltodict result contains xsi:nil="true" or StUF:noValue="geenWaarde"