I'm using Django rest framework and on a POST request need to make an external request to a SOAP server which outputs weather reports. I receive something like this to my API
{
'city': 'Manchester',
'country': 'GB',
'locality': 'EU'
}
Now this is the data I get. Serializing this data is fine and I get that. However since the SOAP address requires me to make a request within the following format I get confused.
I haven't really tried anything but looking for a best solution in this.
{
'geopgrahpy': {
'country': 'GB',
'city': 'Manchester',
},
'locality': 'EU',
'userID': '123',
'password': 'xxxxx'
}
My question is what would be the best solution? Manually building a util function which will return the userID, password (from the request) or build another serializer matching to the soap server needs.
Also bear in mind I know SOAP is XML but the Zeep library converts it to and from XML.