Reputation: 115
I am new to using the framework zeep. I am trying to send a SOAP request . But I get the below incorrect data. I need to get the response in xml or csv format.
<Element {http://schemas.xmlsoap.org/soap/envelope/}Envelope at 0x7fabdc9ea888>
With the wsdl, I am able to fetch the correct output using SoapUI tool.
from requests import Session
from zeep import Client
from zeep.transports import Transport
from requests.auth import AuthBase, HTTPBasicAuth
import datetime
wsdl = 'http://XX.XXX.XX.XX:ZZZZ/TL/IM?wsdl'
session = Session()
session.auth = SymantecAuth('user','password', "http://XX.XXX.XX.XXX")
session.verify = False
transport = Transport(session=session)
client = Client(wsdl=wsdl, transport=transport)
request_data = {"platforms": "test", "platid": {"ID": "QI4552"}}
results=client.create_message(client.service, 'RetrieveID', request_data)
print(results)
Upvotes: 1
Views: 1819
Reputation: 1461
Since you are creating the message, print(results)
is just showing the message object created.
Instead this should work to print the message on screen:
from lxml import etree
# Your code follows here
results=client.create_message(client.service, 'RetrieveID', request_data)
# this will print the message to be sent to Soap service.
print(etree.tostring(results, pretty_print=True))
If you want to see the response of the RetrieveID
operation. then do this instead (Provided this method is bound on 1st available binding):
response = client.service.RetrieveID(**request_data)
print(response)
Let us know if it doesn't work.
Upvotes: 1