0

I am implementing a client for interaction with a SOAP WebService. This WebService has two parameters: a string and an xml.
I am a beginner in development with python but I would like to know how I can get an xml file from my machine to send it to my client.
I Tried :

test = open('LCL.XML')  
test = test.read()
print(test)

But it did not work.

return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position
 492: character maps to <undefined>
NTI
  • 83
  • 1
  • 10

1 Answers1

0

Here is how to read and xml file and get it ready for sending vis SOAP:

import xml.etree.ElementTree filename = 'whatever.xml' result = xml.etree.ElementTree.parse(filename).getroot() xml_str = xml.etree.ElementTree.tostring(result, encoding='utf-8')

Then send xml_str in zeep.Client.service.<your soap call>(..., xml_str, ...)

mcb
  • 398
  • 2
  • 12