您好Stackoverflow社区!
我尝试使用Python suds和ewsclient与Exchange交谈。我创建了一个小的prog,它似乎发送了正确的soap消息,但它总是被Exchange服务器拒绝。
python code for this request is on gist。
肥皂消息:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/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/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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>
结果:
<?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:ErrorInvalidRequest</faultcode>
<faultstring xml:lang="de-AT">The request is invalid.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidRequest</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request is invalid.</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
我的请求与MS developer documentation之间的唯一区别是名称空间前缀。
关于该请求有什么问题的任何想法?
答案 0 :(得分:0)
另一个区别是您包含空Header
元素。你试过把它留下来吗?
答案 1 :(得分:0)
我测试了很多,发现Exchange不喜欢<ns0:DistinguishedFolderId Id="inbox"/>
元素。如果我删除它,我将不会收到无效的请求响应,但是缺少folderIds。
似乎SUDS不再维护,我甚至尝试使用suds jurko,但我遇到了类似的问题。所以很多工作,并不是真正有用的方法来使用EWS SOAP与python。
似乎我必须将该程序切换回Groovy和Java。