我正在尝试与邮递员测试EWS。我尝试从https://outlook.office365.com/EWS/Exchange.asmx获取WSDL,但是从链接返回的WSDL引发未找到的错误。
基本身份验证后,我能够从https://outlook.office365.com/ews/services.wsdl获取WDSL。
用于执行SOAP调用
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">*</Action>
</s:Header>
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInvalidRequest</faultcode>
<faultstring xml:lang="en-US">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>
例如,我的XML POST内容是
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2006" />
</soap:Header>
<soap:Body >
<m:FindPeople>
<m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
<m:ParentFolderId>
<t:DistinguishedFolderId Id="contacts"/>
</m:ParentFolderId>
</m:FindPeople>
</soap:Body>
</soap:Envelope>
我正在尝试遵循SOAP请求(https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/findpeople-operation)。我想念什么吗?
答案 0 :(得分:1)
您的帖子有多个错误
ParentCollection pCollection =
JsonConvert.DeserializeObject<ParentCollection>(json, new ParentCollectionConverter());
这是不正确的,也许您不是说要使用Exchange2006
<t:RequestServerVersion Version="Exchange2006" />
您还已经将名称空间从http修改为https,您不应触摸(这并不意味着它将使用http(或https),这些只是名称空间声明,而您的更改仅使您的请求无效)
例如工作请求看起来像
<t:RequestServerVersion Version="Exchange2016" />