Exchange 服务器无法正确处理包含中文内容的 EWS soap 请求



all:

我想使用 EWS 发送创建日历项目操作请求,我的某些内容(例如主题)可能包含中文字符。这是我的请求肥皂的样子

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Header>
  <RequestServerVersion xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1"/>
</Header>
<Body>
  <CreateItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" SendMeetingInvitations="SendToNone">
    <SavedItemFolderId>
      <DistinguishedFolderId xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Id="calendar"/>
    </SavedItemFolderId>
    <Items>
      <CalendarItem xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
        <Subject>新建日程</Subject>
        <ReminderIsSet>true</ReminderIsSet>
        <ReminderMinutesBeforeStart>15</ReminderMinutesBeforeStart>
        <Start>2016-06-22T09:00:00</Start>
        <End>2016-06-22T10:00:00</End>
      </CalendarItem>
    </Items>
  </CreateItem>
</Body>
</Envelope>

我用 utf-8 对这个 xml 进行编码,并将其发送到我的测试 Exchange 服务器,过了一会儿,它显示在该服务器上,但在 Subject 属性中带有问号而不是"新建日程"。所有其他属性都正确显示。

所以我想知道我哪里做错了中文内容无法正确显示。有什么建议吗?

最后,我弄清楚出了什么问题。它位于请求标头中。我发现标题忘记将字符集设置为 utf-8。多么简单但愚蠢的错误.....

最新更新