Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header can be missing in response #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yscumc
Copy link

@yscumc yscumc commented Aug 28, 2013

Minor problem which I spent quite some time debugging...

I got the following trace when initializing EWSWrapper:

...
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 109, in __init__
    self.version = self.Version(self)
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 118, in __init__
    self.minorbuildnumber = self.get()
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 193, in get
    info = header.find('{%s}ServerVersionInfo' % tns).attrib
AttributeError: 'NoneType' object has no attribute 'find'

This was caused by the following response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInvalidServerVersion</faultcode>
         <faultstring xml:lang="en-US">The specified server version is invalid.</faultstring>
         <detail>
            <e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidServerVersion</e:ResponseCode>
            <e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The specified server version is invalid.</e:Message>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

With this PR applied, it'll look like this instead, which makes debugging much more easily:

...
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 109, in __init__
    self.version = self.Version(self)
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 118, in __init__
    self.minorbuildnumber = self.get()
  File "C:\Python27\lib\site-packages\EWSWrapper_py\EWSWrapper.py", line 194, in get
    raise Exception('No header in response: %s' % response)
Exception: No header in response: <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/
soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorI
nvalidServerVersion</faultcode><faultstring xml:lang="en-US">The specified server version is invalid.</faultstring><deta
il><e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidServerVersion</e:Res
ponseCode><e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The specified server version i
s invalid.</e:Message></detail></s:Fault></s:Body></s:Envelope>

Not sure why the server didn't accept the request as I haven't looked into that yet. Will file as a separate issue.

@yscumc yscumc closed this Aug 28, 2013
@yscumc yscumc reopened this Aug 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant