首页 > 解决方案 > 如何在 EWS SOAP 响应中获取更详细的错误信息?

问题描述

我将 SOAP 调用发布到 Exchange 网络服务(使用 Delphi 和 IpWorks TipwHTTP 组件),其中一些返回内部服务器错误(一些 CreateItem 和 UpdateItem SOAP 操作),但没有更多信息:

<?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:ErrorInternalServerError</faultcode>
<faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

使用 EWS 托管 API 时,有诸如 tracking 之类的东西但我没有使用该 API。
下面是一个用户使用它获得更详细错误信息的示例:

<m:ResponseMessages>
  <m:FindItemResponseMessage ResponseClass="Error">
    <m:MessageText>An internal server error occurred. The operation failed.</m:MessageText>
    <m:ResponseCode>ErrorInternalServerError</m:ResponseCode>
    <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
    <m:MessageXml>
      <t:Value Name="InnerErrorMessageText">Too many concurrent connections opened.</t:Value>
      <t:Value Name="InnerErrorResponseCode">ErrorTooManyObjectsOpened</t:Value>
      <t:Value Name="InnerErrorDescriptiveLinkKey">0</t:Value>
    </m:MessageXml>
  </m:FindItemResponseMessage>
</m:ResponseMessages>

有什么我可以添加到 SOAP 请求或 HTTP 标头中的东西,可以给我额外的错误信息吗?

失败调用的完整示例:

- - 要求 - -

POST /ews/exchange.asmx HTTP/1.1
Host: webmail.timetellbv.nl
Authorization: NTLM TlRMTVN[snip]AAAA=
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: IPWorks HTTP Component - www.nsoftware.com
SOAPAction: "http://schemas.microsoft.com/exchange/services/2006/messages/UpdateItem"
Content-Type: text/xml; charset=utf-8
Content-Length: 6485



<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:typ="http://schemas.microsoft.com/exchange/services/2006/types"
  xmlns:mes="http://schemas.microsoft.com/exchange/services/2006/messages">
<soapenv:Header>
  <typ:RequestServerVersion Version="Exchange2007_SP1"/>
  <typ:MailboxCulture>en-US</typ:MailboxCulture>
  <typ:TimeZoneContext>
     <typ:TimeZoneDefinition Id="W. Europe Standard Time"/>
  </typ:TimeZoneContext>
</soapenv:Header>
<soapenv:Body>
<mes:UpdateItem ConflictResolution="AlwaysOverwrite" SendMeetingInvitationsOrCancellations="SendToNone">
   <mes:ItemChanges>
      <typ:ItemChange>
         <typ:ItemId Id="AAMkADQz[snip]wAAA=" ChangeKey="DwAAA[snip]nxYa" />
         <typ:Updates>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="item:Subject"/>
               <typ:CalendarItem>
                 <typ:Subject>Voorbereiden op Fokkema (10-3)</typ:Subject>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="item:Sensitivity"/>
               <typ:CalendarItem>
                 <typ:Sensitivity>Normal</typ:Sensitivity>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="item:Categories"/>
               <typ:CalendarItem>
                  <typ:Categories>
                     <typ:String>TimeTell</typ:String>
                  </typ:Categories>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="item:Body"/>
               <typ:CalendarItem>
                 <typ:Body BodyType="Text">Export projectgegevens van budget naar planningsmodule.</typ:Body>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:Location"/>
               <typ:CalendarItem>
                 <typ:Location></typ:Location>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:IsAllDayEvent"/>
               <typ:CalendarItem>
                 <typ:IsAllDayEvent>false</typ:IsAllDayEvent>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:Start"/>
               <typ:CalendarItem>
                 <typ:Start>2020-03-04T13:00:00.000+01:00</typ:Start>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:End"/>
               <typ:CalendarItem>
                 <typ:End>2020-03-04T15:00:00.000+01:00</typ:End>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:LegacyFreeBusyStatus"/>
               <typ:CalendarItem>
                 <typ:LegacyFreeBusyStatus>Busy</typ:LegacyFreeBusyStatus>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:FieldURI FieldURI="calendar:MeetingTimeZone"/>
               <typ:CalendarItem>
                  <typ:MeetingTimeZone TimeZoneName="W. Europe Standard Time"/>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellID" PropertyType="Integer"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellID" PropertyType="Integer"/>
                     <typ:Value>1707908</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncTime" PropertyType="SystemTime"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncTime" PropertyType="SystemTime"/>
                     <typ:Value>2020-03-03T10:09:41.949+01:00</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncVer" PropertyType="Integer"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncVer" PropertyType="Integer"/>
                     <typ:Value>90100</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
            <typ:SetItemField>
               <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncID" PropertyType="String"/>
               <typ:CalendarItem>
                  <typ:ExtendedProperty>
                     <typ:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="TimeTellSyncID" PropertyType="String"/>
                     <typ:Value>00000[snip]000</typ:Value>
                  </typ:ExtendedProperty>
               </typ:CalendarItem>
            </typ:SetItemField>
         </typ:Updates>
      </typ:ItemChange>
   </mes:ItemChanges>
</mes:UpdateItem>
</soapenv:Body>
</soapenv:Envelope>

- - 回复 - -

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/10.0
request-id: 679f24c4-547e-4728-a102-049708a78b3a
X-CalculatedBETarget: ttexchange2016.timetellbv.nl
X-DiagInfo: TTEXCHANGE2016
X-BEServer: TTEXCHANGE2016
X-AspNet-Version: 4.0.30319
Set-Cookie: exchangecookie=4b2979acfda04a04896f69c7e3d6d60d; expires=Wed, 03-Mar-2021 09:07:41 GMT; path=/; HttpOnly
Set-Cookie: X-BackEndCookie=S-1-5-21-856652257-446748123-1738634499-1192=u56Lnp[snip]Bzw==; expires=Thu, 02-Apr-2020 09:07:41 GMT; path=/ews; secure; HttpOnly
Persistent-Auth: true
X-Powered-By: ASP.NET
X-FEServer: TTEXCHANGE2016
Date: Tue, 03 Mar 2020 09:07:41 GMT

<?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:ErrorInternalServerError</faultcode>
<faultstring xml:lang="en-US">An internal server error occurred. The operation failed.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInternalServerError</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">An internal server error occurred. The operation failed.</e:Message>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

(我格式化了最后一个 XML 部分)。如您所见,没有比“内部错误”更多的错误信息。

根据评论中的讨论添加:

标签: delphisoapexchangewebservicesdelphi-10.3-rio

解决方案


推荐阅读