使用邮递员测试 Microsoft EWS(Exchange Web 服务)
Testing Microsoft EWS (Exchange web service) using postman
我正在尝试与邮递员一起测试 EWS。我试图从 https://outlook.office365.com/EWS/Exchange.asmx 获取 WSDL,但是从 link 返回的 WSDL 抛出一个未找到的错误。
基本授权后,我能够从 https://outlook.office365.com/ews/services.wsdl 获得 WDSL。
用于执行 SOAP 调用
- 我尝试向 https://outlook.office365.com/ews/services.wsdl 发送 POST 请求,这导致 HTTP 405 Method not Allowed。
- 我尝试向 https://outlook.office365.com/EWS/Exchange.asmx 发送 POST 请求,它返回了以下响应。
<?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>
我的XMLPOST内容例如这个
<?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)。我错过了什么吗?
您的 post 有多个错误
<t:RequestServerVersion Version="Exchange2006" />
这是不正确的,可能您的意思是没有 Exchange2006
<t:RequestServerVersion Version="Exchange2016" />
您还修改了您不应触及的命名空间从 http 到 https(这并不意味着它将使用 http(或 https)这些只是命名空间声明,您的更改只是使您的请求无效)
例如,工作请求看起来像
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
</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>
我正在尝试与邮递员一起测试 EWS。我试图从 https://outlook.office365.com/EWS/Exchange.asmx 获取 WSDL,但是从 link 返回的 WSDL 抛出一个未找到的错误。
基本授权后,我能够从 https://outlook.office365.com/ews/services.wsdl 获得 WDSL。
用于执行 SOAP 调用
- 我尝试向 https://outlook.office365.com/ews/services.wsdl 发送 POST 请求,这导致 HTTP 405 Method not Allowed。
- 我尝试向 https://outlook.office365.com/EWS/Exchange.asmx 发送 POST 请求,它返回了以下响应。
<?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>
我的XMLPOST内容例如这个
<?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)。我错过了什么吗?
您的 post 有多个错误
<t:RequestServerVersion Version="Exchange2006" />
这是不正确的,可能您的意思是没有 Exchange2006
<t:RequestServerVersion Version="Exchange2016" />
您还修改了您不应触及的命名空间从 http 到 https(这并不意味着它将使用 http(或 https)这些只是命名空间声明,您的更改只是使您的请求无效)
例如,工作请求看起来像
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2016" />
</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>