With more effort than necessary, this is the answer.
I have foam version 0.3.9. I had to subclass the transport class used and wrap a method sendto store the last received headers in the transport class.
import logging
logging.basicConfig(level=logging.INFO)
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
from suds.transport.https import HttpAuthenticated
class MyTransport(HttpAuthenticated):
def __init__(self,*args,**kwargs):
HttpAuthenticated.__init__(self, *args, **kwargs)
self.last_headers = None
def send(self,request):
result = HttpAuthenticated.send(self, request)
self.last_headers = result.headers
return result
doctor = ImportDoctor(Import('http://schemas.xmlsoap.org/soap/encoding/'))
svc_url = 'https://server/Service?wsdl'
svc_user = 'username'
svc_pass = 'password'
client = Client(svc_url,doctor=doctor,transport=MyTransport())
client.set_options(location=svc_url.partition('?')[0],username=svc_user,password=svc_pass)
client.service.SomeMethod()
client.options.transport.last_headers
source
share