簡體   English   中英

發送GetItem請求時出現HTTP 401未經授權的錯誤

[英]HTTP 401 Unauthorized error in sending GetItem Request

我正在使用EWS GetItem操作從交換服務器獲取數據,但是出現以下錯誤

Error 401 fault: SOAP-ENV:Server[no subcode] "HTTP Error" Detail: HTTP/1.1 401 Unauthorized

但是我的登錄憑據是正確的,因為它們與findItem請求和響應都可以很好地工作,但是當GetItem請求進入服務器時,它會給出上述錯誤。 我的憑證如下:

soap *pSoap = proxy->soap;
proxy->soap_endpoint = "https://outlook.office365.com/ews/exchange.asmx";
pSoap->userid = "abcd@abcd.onmicrosoft.com";
pSoap->passwd = "abcd1234";

和收到的日志就像

HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/8.0
request-id: b66330dd-37a5-40c0-946f-12a204b2eacb
Set-Cookie: ClientId=OVJLSVEMECIIUMMAXM9JA; expires=Thu, 22-Sep-2016 18:00:57 GMT; path=/; secure; HttpOnly
X-CalculatedBETarget: SG2PR06MB1165.apcprd06.prod.outlook.com
X-BackEndHttpStatus: 200
Set-Cookie: exchangecookie=fa26578c8e659cf1ccc3f50b3a83; expires=Fri, 23-Sep-2016 18:00:58 GMT; path=/; HttpOnly
x-EwsHandler: FindItem
X-AspNet-Version: 4.0.30319
X-DiagInfo: SG2PR06MB1165
X-BEServer: SG2PR06MB1165
Set-Cookie: ClientId=OVJLSVEIIUMMAXM9JA; expires=Thu, 22-Sep-2016 18:00:57 GMT; path=/; secure; HttpOnly
X-Powered-By: ASP.NET
X-FEServer: SG2PR03CA0031
Date: Wed, 23 Sep 2015 18:00:58 GMT
Connection: close

17d
<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="268" MinorBuildNumber="21" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
1e8
</s:Header><s:Body><m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><m:ResponseMessages><m:FindItemResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode><m:RootFolder TotalItemsInView="2" IncludesLastItemInRange="true"><t:Items><t:Message><t:ItemId Id="
edAQAfAGNvObtNFsAAAA==" ChangeKey="CQfwjm7TRbAAAAAAWl"/></t:Message><t:Message><t:ItemId Id="
133AQAfAGCObtNFsAAAIFUAAAAA==" ChangeKey="CQAAABYAAACZNImAAAAAWT"/></t:Message></t:Items></m:RootFolder></m:FindItemResponseMessage></m:ResponseMessages></m:FindItemResponse>
</s:Body></s:Envelope>


/*  This below log for getItem Request*/

HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/8.0
request-id: 7a1a654c-fa72-46b0-ab76-a6045c576d9f
Set-Cookie: ClientId=H8THXUH0BECF9HJMTXHEW; expires=Thu, 22-Sep-2016 18:01:01 GMT; path=/; secure; HttpOnly
X-Powered-By: ASP.NET
X-FEServer: SG2PR03CA0003
WWW-Authenticate: Basic Realm=""
Date: Wed, 23 Sep 2015 18:01:00 GMT
Connection: close
Content-Length: 0

這里可能有什么問題,為什么一個請求通過而另一個請求失敗? 任何想法? 謝謝。

我知道了!,發生錯誤是因為我的第二個請求無法在交換服務器上登錄。 因為我只提供了一次憑據,所以當findItem響應到來時,與服務器的連接“關閉”,而我的下一個后續請求無法登錄。 所以我必須再次登錄到服務器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM