I use foam to request data from a third party using wsdl. I only save some data that is currently returned, but I pay for the data I receive, so I would like to save all this. I decided that the best way to save this data is to capture the original XML response in the database field as for future use, I have to decide that I want to start using different parts of the data and as a paper trace in case of discrepancies,
So, I have two questions:
Is there an easy way to output the raw received xml from a suds.client object? In my search for an answer to this, I found out that this can be done by logging, but I hoped that you would not have to pull this information out of the logs to place in the database field. I also looked at MessagePlugin.recieved () hook, but couldn't figure out how to access this information after parsing it, only so that I could override this function and access the raw XML object when it is parsed (which before as I decided whether it really is worth saving or not). I also studied the retxml option, but I would also like to use the collapsible version and make two separate calls: one as retxml and the other parsed will cost me twice. I was hoping for a simple function built into the suds client (e.g. response.as_xml () or something as simple as that), but so far have not found anything like it. The option, bubbling around in my head, may consist in expanding the client object with the .received () plug-in, which saves the xml as an object parameter before parsing it, for referencing it later ... but doing it seems a bit difficult for me now , and I hardly believe that the suds client hasn't just created it somewhere, so I thought I'd ask first.
Another part of my question is: what type of django model field is best suited for processing up to 100 kilobytes of text data as raw xml? I was going to just use a simple CharField with a silly long max_length, but that seems wrong.
Thanks in advance.
python soap xml django suds
krayzk Oct 08 '14 at 21:33 2014-10-08 21:33
source share