我从 SOAP 服务收到此响应,但无法解析响应。我想读取 gtin 的值。
client = zeep.Client(wsdl=wsdl)
#The soap call receives 4 arguments, the last argument is the response format
soapCall = client.service.GetStock(1,104500009,104500009,"XML")
以下是 Eclipse 中 pydev 调试器中响应的样子:
GetStockResponse: {\n 'GetStockResult': '<DRSStock>\\n <Shop Number="1">\\n <s v="104500009" vi1="13" vi2="1001" gtin="5018746023776" q="1" /> <s v="104500009" vi1="31" vi2="1001" gtin="5018746004058" q="0" /> <s v="104500009" vi1="32" vi2="1001"
我尝试使用它来解析响应,但出现以下错误:
xml_data = etree.parse(soapCall)
错误:
TypeError: cannot parse from 'GetStockResponse'