So, here's the debug output:
DEBUG:suds.client:sending to
(
https://webmail.crchealth.com/ews/exchange.asmx)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:ns0="http://schemas.microsoft.com/exchange/services/2006/types...
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messa...
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns2:GetFolder>
<ns2:FolderShape>
<ns0:BaseShape>Default</ns0:BaseShape>
</ns2:FolderShape>
<ns2:FolderIds>
<ns0:DistinguishedFolderId Id="inbox"/>
</ns2:FolderIds>
</ns2:GetFolder>
</ns1:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction':
u'"http://schemas.microsoft.com/exchange/services/2006/messages/...;,
'Content-Type': 'text/xml;
charset=utf-8'}
DEBUG:suds.client:http succeeded:
<h1>Bad Request (Invalid Verb)</h1>
Traceback (most recent call last):
File "./get_mail.py", line 43, in <module>
{'_Id':'inbox'}})
File "/home/jkugler/src/suds-trunk/suds/client.py", line 539, in
__call__
return client.invoke(args, kwargs)
File "/home/jkugler/src/suds-trunk/suds/client.py", line 598, in
invoke
result = self.send(msg)
File "/home/jkugler/src/suds-trunk/suds/client.py", line 627, in send
result = self.succeeded(binding, reply.message)
File "/home/jkugler/src/suds-trunk/suds/client.py", line 659, in
succeeded
r, p = binding.get_reply(self.method, reply)
File "/home/jkugler/src/suds-trunk/suds/bindings/binding.py", line
146, in get_reply
soapenv.promotePrefixes()
AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
So, the error is expected given the reply from the server.
Code snippet:
import suds
from suds.transport.https import WindowsHttpAuthenticated
logging.basicConfig(level=logging.CRITICAL)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
ntlm = WindowsHttpAuthenticated(username=r'DOMAIN\user',
password='****')
c =
suds.client.Client('file:///home/jkugler/crc/local-tools/services.wsdl',
transport=ntlm,
headers=headers)
print c.service.GetFolder({'BaseShape':'Default'},
{'DistinguishedFolderId':
{'_Id':'inbox'}})
The example for this call is here:
http://msdn.microsoft.com/en-us/library/aa580274(v=EXCHG.140).aspx
Differences:
Namespace designators...but you declare them in the envelope, so that
shouldn't be an issue.
"UTF-8" is lower case in the example. *Really* shouldn't matter, but who
knows.
I also noticed that the SOAPAction in the header is double quoted: that
is: u'"...."' Is there a reason for that?
Suds does this:
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
The MS example does this:
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
I don't have enough knowledge of soap to know if any of these things
(should) matter.
The other issue I'm having that I alluded to is that the NTLM module (or
transport) seems to be having major issues with my company's server.
I'm going to have to found out if they are running 2003 or 2008. But
what happens is it just sits there and then finally generates this
traceback:
Traceback (most recent call last):
File "./get_mail.py", line 42, in <module>
{'_Id':'inbox'}})
File "/home/jkugler/src/suds-trunk/suds/client.py", line 539, in
__call__
return client.invoke(args, kwargs)
File "/home/jkugler/src/suds-trunk/suds/client.py", line 598, in
invoke
result = self.send(msg)
File "/home/jkugler/src/suds-trunk/suds/client.py", line 623, in send
reply = transport.send(request)
File "/home/jkugler/src/suds-trunk/suds/transport/https.py", line 64,
in send
return HttpTransport.send(self, request)
File "/home/jkugler/src/suds-trunk/suds/transport/http.py", line 77,
in send
fp = self.u2open(u2request)
File "/home/jkugler/src/suds-trunk/suds/transport/http.py", line 118,
in u2open
return url.open(u2request, timeout=tm)
File "/usr/lib/python2.6/urllib2.py", line 395, in open
response = meth(req, response)
File "/usr/lib/python2.6/urllib2.py", line 508, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.6/urllib2.py", line 427, in error
result = self._call_chain(*args)
File "/usr/lib/python2.6/urllib2.py", line 367, in _call_chain
result = func(*args)
File
"/usr/local/lib/python2.6/dist-packages/python_ntlm-1.0-py2.6.egg/ntlm/HTTPNtlmAuthHandler.py",
line 96, in http_error_401
return self.http_error_authentication_required('www-authenticate',
req, fp, headers)
File
"/usr/local/lib/python2.6/dist-packages/python_ntlm-1.0-py2.6.egg/ntlm/HTTPNtlmAuthHandler.py",
line 35, in http_error_authentication_required
return self.retry_using_http_NTLM_auth(req, auth_header_field, None,
headers)
File
"/usr/local/lib/python2.6/dist-packages/python_ntlm-1.0-py2.6.egg/ntlm/HTTPNtlmAuthHandler.py",
line 86, in retry_using_http_NTLM_auth
raise urllib2.URLError(err)
urllib2.URLError: <urlopen error [Errno 104] Connection reset by peer>
But, I'm not sure if that's a Suds issue.
Anyway, I'll see what I can do to get around this.
j
--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key:
http://pgp.mit.edu/ ID 0x73B13B6A