【问题标题】:Python suds.TypeNotFound at Exchange EWS 2010Python suds.TypeNotFound 在 Exchange EWS 2010
【发布时间】:2013-04-26 08:17:52
【问题描述】:

我只是尝试使用 Alex Koshelev 的 EWS 特定的 suds 分支(可在 BitBucket 上找到)使用 Python 访问 Exchange Web Services (EWS) 2010。 我找到了访问 EWS here 的基本代码,到目前为止它运行良好。但是,当我尝试实现需要属性的其他操作(如 FindFolder 操作)时,它会失败。

这是我正在使用的代码:

import urllib2    

from suds.client import Client
from suds.sax.element import Element
from suds.transport.https import HttpTransport

class Transport(HttpTransport):
    def __init__(self, **kwargs):
        realm, uri = kwargs.pop('realm'), kwargs.pop('uri')
        HttpTransport.__init__(self, **kwargs)
        self.handler = urllib2.HTTPBasicAuthHandler()
        self.handler.add_password(realm=realm,
                                  user=self.options.username,
                                  passwd=self.options.password,
                                  uri=uri)
        self.urlopener = urllib2.build_opener(self.handler)

transport = Transport(realm='owa10.123together.com',
                      uri='https://owa10.123together.com',
                      username='demo10@owatest10.123together.com',
                      password='demo123!')
client = Client("https://owa10.123together.com/EWS/Services.wsdl",
                transport=transport) 

ns = ('t', 'http://schemas.microsoft.com/exchange/services/2006/types')

soap_headers = Element('RequestServerVersion', ns=ns)
soap_headers.attributes.append('Version="Exchange2010_SP1"') 
client.set_options(soapheaders=soap_headers)

address = client.factory.create('t:EmailAddress')
address.Address = 'demo10@owatest10.123together.com'

traversal = client.factory.create('t:FolderQueryTraversalType')
#traversal.Traversal = 'Deep'

#print client.service.GetUserOofSettings(address)
test =  client.service.FindFolder(traversal)
print test

当我运行此代码时,我收到以下错误:

suds.TypeNotFound: Type not found: 'Shallow'

我还使用了记录器来找出问题所在,它显示了以下内容:

DEBUG:suds.mx.literal:starting content:
(Content){
   tag = "Shallow"
   value = "Shallow"
   type = None
 }

有人知道问题出在哪里吗?是我的一段代码还是 .wsdl 文件不行? 请注意,我对 Python 非常熟悉,尤其是 suds。如果您需要更多信息或代码,请告诉我。

非常感谢您!

【问题讨论】:

    标签: python web-services exchange-server exchangewebservices suds


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多