2013-01-11 93 views
0

我使用Exchange Server 2010處理EWS託管API。 當我請求FindItem時,服務器發生錯誤 - 「ErrorIncorrectSchemaVersion」 「請求有效,但沒有在RequestServerVersion SOAP頭中指定正確的服務器版本。請確保RequestServerVersion SOAP頭設置了正確的RequestServerVersionValue。 「 但在XML中,我已將RequestServerVersionValue指定爲Exchange2010。 我也嘗試指定Exchange2007,Exchange2007_SP1,Exchange2010_SP1,但沒有任何更改。RequestServerVersionValue在對Exchange Web服務的API請求中不起作用

<?xml version="1.0" ?> 
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
- <SOAP-ENV:Body> 
- <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" Traversal="Shallow"> 
- <ItemShape> 
    <BaseShape xmlns="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</BaseShape> 
    </ItemShape> 
    <IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning" /> 
- <ParentFolderIds> 
- <DistinguishedFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Id="calendar"> 
- <Mailbox> 
    <EmailAddress>[email protected]</EmailAddress> 
    </Mailbox> 
</DistinguishedFolderId> 
    </ParentFolderIds> 
    </FindItem> 
- <ExchangeImpersonation xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
- <ConnectingSID> 
<PrimarySmtpAddress>[email protected]</PrimarySmtpAddress> 
</ConnectingSID> 
    </ExchangeImpersonation> 
    <MailboxCulture xmlns="http://schemas.microsoft.com/exchange/services/2006/types">US-en</MailboxCulture> 
    <RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2010" /> 
- <TimeZoneContext xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
- <TimeZoneDefinition Id="FLE Standard Time"> 
- <Periods> 
    <Period Id="FLE Standard Time" /> 
    </Periods> 
    </TimeZoneDefinition> 
    </TimeZoneContext> 
    </SOAP-ENV:Body> 
    </SOAP-ENV:Envelope> 
+0

你試過提琴手找到德爾福之間的差異要求C#/ Java客戶端(WCF,SoapUI)? – mjn

+0

我沒有。我只有Delphi客戶端。也許有人熟悉Delphi和Exchange WSDL,並從Exchange生成有效的Delphi單元?成爲我的一個是非常錯誤的,有些類將無法正常工作。 – dream2work

+0

SoapUI是一個免費且非常流行的SOAP測試工具,它允許執行SOAP請求,您只需要在那裏導入WSDL,然後調用方法 – mjn

回答

1

你的XML塊,應該是一個SOAP頭,像這樣:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <SOAP-ENV:Header> 
    <ExchangeImpersonation xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <ConnectingSID> 
    <PrimarySmtpAddress>[email protected][snip].nl</PrimarySmtpAddress> 
    </ConnectingSID> 
    </ExchangeImpersonation> 
    <MailboxCulture xmlns="http://schemas.microsoft.com/exchange/services/2006/types">US-en</MailboxCulture> 
    <RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2010" /> 
    <TimeZoneContext xmlns="http://schemas.microsoft.com/exchange/services/2006/types"> 
    <TimeZoneDefinition Id="FLE Standard Time"> 
     <Periods> 
     <Period Id="FLE Standard Time" /> 
     </Periods> 
    </TimeZoneDefinition> 
    </TimeZoneContext> 
    </SOAP-ENV:Header> 
    <SOAP-ENV:Body> 
    <FindItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" Traversal="Shallow"> 
    <ItemShape> 
     <BaseShape xmlns="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</BaseShape> 
    </ItemShape> 
    <IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning" /> 
    <ParentFolderIds> 
     <DistinguishedFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Id="calendar"> 
     <Mailbox> 
      <EmailAddress>[email protected][snip].nl</EmailAddress> 
     </Mailbox> 
     </DistinguishedFolderId> 
    </ParentFolderIds> 
    </FindItem> 
    </SOAP-ENV:Body> 
</SOAP-ENV:Envelope>  

運行這會給你一個錯誤;-)
ErrorTimeZone - 用於偏置屬性期間被設置爲null

而且我發現這個測試用了SoapUI(提示!)

+0

此XML完全由Delphi生成。我只在OnBeforeExecute事件中承認它。現在我使用Excahnge 2007中的WSDL與Exchange 2010交流,並且它更好。我發送FindItem,甚至用項目獲取有效的XML,但Delphi返回具有錯誤屬性的FindItemResponse對象。我真的不知道下一步該怎麼做。也許直接使用XML會更好,而不是Delphi從WSDL生成的醜陋類。 – dream2work

+0

我已經放棄嘗試使用WSDL。發送XML的工作合理,但我從來沒有設法解析導入類型庫中的代碼的結果。 –

+0

你是如何設法通過soapUI與Exhange服務器協同工作的?我設置了正確的用戶名和密碼,但得到了「HTTP/1.1 401 Unauthorized」錯誤。 – dream2work