In this tutorial, you will learn how to decode and parse a large SOAP XML response with Python and regular expression, essentially the goal here was to build a Python function to get rid of manually decoding SOAP XML response over and over again.

The Python code I’m about to explain and show you was developed as a part of refund payment integration done in Python and Django. 

We’re going to take a look at an encoded SOAP XML response stdout saved in a text file.

I saved this SOAP response output when I was in a process of developing a payment integration feature for a local bank here in Riga, Latvia, along the way I realized it’s going to be a great learning experience for anyone else who’s going to search for a similar solution on Google. 

I’ve discussed similar text file parsing in Python situations before here on the blog, but the difference here is that this one is way more complicated and involves a bit more decoding and text manipulation as well as extensive knowledge on regex pattern matching. 

Definitely a good Python regular expression practice, even for advanced Python developers. 

Currently, I’m working as a Python Django backend developer (Roberts Greibers) for a local company here in Riga, Latvia – building a white-label payment gateway platform, you can find more about my experience on my Linkedin profile

Give me a follow on Linkedin or send me a DM if you have any questions. 

One of the recent payment integration flows I needed to develop was for a refund payment. Refund payments were supposed to work for multiple banks through one gateway system for this particular client and brand. 

The whole refund payment flow is way more complicated and would take me weeks to write up and explain here on the blog so I’m gonna share a small portion of what actually was very interesting to work on – parsing decoded SOAP XML response with regular expression in Python. 

I go deeper explaining features you can develop for your Python and Django portfolio if you’re working personally with me in one on one Zoom calls (click here to see an example of a LIVE Zoom call). I personally will guide you through the development of each feature and answer all your questions along the way. 

This is what we’re working on with my most successful mentoring clients.

So if the above sounds interesting, let’s get started! 

Continue reading