How to pass SOAP headers into python SUDS that are not defined in WSDL file

Posted by chrissygormley on Stack Overflow See other posts from Stack Overflow or by chrissygormley
Published on 2010-03-18T13:08:28Z Indexed on 2010/03/18 13:11 UTC
Read the original article Hit count: 983

Filed under:
|
|
|
|

Hello,

I have a camera on my network, I am trying to connect to it with suds but suds doesn't send all the information needed. I need to put extra soap headers not defined in the WSDL file so the camera can understand the message. All the headers are contained in a SOAP envelope and then the suds command be in the body of the message.

I have checked the suds website and it says to pass in the headers like so:

from suds.sax.element import Element
client = client(url)
ssnns = ('ssn', 'http://namespaces/sessionid')
ssn = Element('SessionID', ns=ssnns).setText('123')
client.set_options(soapheaders=ssn) 
result = client.service.addPerson(person)

Now I am not sure how I would implement this, say for example I have the below header:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP
ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:p1="http://www.website.org/ver10/p/wsdl">
.<SOAP-ENV:Header>

Using this or a similar example does anyone know hos I would get this passed into the soap command so my camera understands?

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about suds