包含无效XML字符的EWS响应 [英] EWS response containing invalid XML characters

查看:117
本文介绍了包含无效XML字符的EWS响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我曾经多次体验到EWS的响应会返回XML中非法的符号字符(至少根据Apache Axis2以及我/我们如何取消和XML规范)。它似乎与unicode控制字符(范围x1 - x1F)有关。

这个问题的一部分可能与EWS返回xml版本1.0(根据XML)但可能(只是可能)有关返回的内容实际上是遵循XML 1.1规范(允许unicode控制字符) - 请附上示例(蓝色突出显示的XML版本 - 红色突出显示无效字符)。

有没有人遇到此问题?有没有人找到解决这个问题的方法?这是Exchange中的错误吗?





































/ REC-xml / #charsets
1.1:http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-xml11

<?xml version =" 1.0" encoding =" utf-8"?>
< soap:Envelope xmlns oap =" http://schemas.xmlsoap.org/soap/envelope/"结果的xmlns:的xsi = QUOT; HTTP://www.w3.org/2001/XMLSchema-instance"结果的xmlns:XSD = QUOT; HTTP://www.w3.org/2001/XMLSchema">
< soap:Header>
< t erverVersionInfo MajorVersion =" 8" MinorVersion = QUOT 1 QUOT; MajorBuildNumber = QUOT; 263" MinorBuildNumber = QUOT; 0"结果,版本=" Exchange2007_SP1"的xmlns:T =" HTTP://schemas.microsoft.com/exchange/services/2006/types" />结果< /皂:抬头>结果<肥皂:车身>结果< M:GetItemResponse结果的xmlns:T =" HTTP://schemas.microsoft.com/exchange /服务/ 2006 /类型"结果的xmlns:M =" HTTP://schemas.microsoft.com/exchange/services/2006/messages">结果< M:ResponseMessages>结果< m:GetItemResponseMessage ResponseClass =" Success">
< m:ResponseCode> NoError< / m:ResponseCode>
< m:Items>
< t:Message>
< T:项目Id编号= QUOT; AAMkADllNTA4YmRjLTgxNTUtNDI3Ny1hZmJkLTU0ODU1NmE0OTAyZQBGAAAAAAChRyxXbJOzTbVl0M0I60jDBwBV + bBUA6OzRITxsDtfENDqAADMEyUvAABV + bBUA6OzRITxsDtfENDqACECYJ2QAAA = QUOT;结果,ChangeKey = QUOT; CQAAABYAAABV + bBUA6OzRITxsDtfENDqACECYhe0" />
< t arentFolderId
Id =" AAMkADllNTA4YmRjLTgxNTUtNDI3Ny1hZmJkLTU0ODU1NmE0OTAyZQAuAAAAAAChRyxXbJOzTbVl0M0I60jDAQBV + bBUA6OzRITxsDtfENDqAADMEyUvAAA = QUOT;结果,ChangeKey = QUOT; AQAAAA ==" />
< t ubject> < br> [实时服务]发生错误
< / t ubject>
< t:Body BodyType =" Text">
thr ead:2424,process:1392,mem:28Mb,VM:28Mb转储异常类型
'系统.Data.SqlClient.SqlException'
消息:SQL Server不存在或访问被拒绝。堆栈跟踪:
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& amp; isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options,Boolean& amp; isIn Transaction)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DBCommandWrappercommand)
在AddOn.Configuration.ConfigurationManager.GetRtsSynchronization(GuidrtsId)
在AddOn.Configuration.ConfigurationManager。&#x1; (对象)

< / t:正文>
< t ateTimeReceived>
2008-06-12T03:10:07Z
< / t ateTimeReceived>
< t:重要性>正常< / t:I mportance>
< t:IsDraft> false< / t:IsDraft>
< t ateTimeSent>
2008-06-12T03:08:18Z
< / t ateTimeSent>
< t ateTimeCreated>
2008-06-12T03:10:07Z
< / t ateTimeCreated>
< t:HasAttachments> false< / t:HasAttachments>
< t :ExtendedProperty>
< t:ExtendedFieldURI PropertyTag =" 0x6707"
PropertyType =" String" />
< t:值>
/收件箱/ [实时服务]发生错误-7.EML
< / t:值>
< / t:ExtendedProperty> < br>< t ender>
< T:邮箱和GT;结果< T:名称>结果,sa-realtime@domain.com结果< / T:名称>结果,< T:EmailAddress的>结果,SA-实时@域.com
< / t:EmailAddress>
< t:RoutingType> SMTP< / t:RoutingType>
< / t:Mailbox>
< / t ender>
< t:ToRecipients>
< t :邮箱和GT;结果< T:名称> SYSADM< / T:名称>结果,< T:EmailAddress的>结果,sysadm@domain.com结果< / T:EmailAddress的>结果< ; T:RoutingType> SMTP< / T:RoutingType>结果< / T:邮箱和GT;结果< / T:ToRecipients>结果< T:从大于;结果< T:邮箱和GT;结果< T:名称>结果,sa-realtime@domain.com结果< / T:名称>结果,< T:EmailAddress的> < BR> sa-realtime@domain.com结果< / T:EmailAddress的>结果< T:RoutingType> SMTP< / T:RoutingType>结果< / T:邮箱和GT;结果< /吨:从大于;结果< T:IsRead>假LT; / T:IsRead>结果< /吨:消息>结果< /米:项目>结果< /米:GetItemResponseMessage> ;
< / m:ResponseMessages>
< / m:GetItemResponse>
< / soap:Body>
< / soap:Envelope>

Hi there,

At several occasions I have experienced that the response from EWS returns contaons characters that are illegal within XML (at least according to Apache Axis2 and also how I/we undertsand the XML specs). It seems to be related to unicode control characters (range x1 - x1F).

Part of this problem may be related to the fact that EWS return xml version 1.0 (according to the XML) but maybe (just maybe) what is returned is in fact adhering to the XML 1.1 spec (which does allow unicode control characters) - please se attached example (XML version highlighted in blue - invalid character highlighted by red).

Has anyone experienced this problem? has anyone found a way around this? is this a bug in Exchange?

Regards
Mads

links to XML specs (to interesting sections):
1.0: http://www.w3.org/TR/REC-xml/#charsets
1.1: http://www.w3.org/TR/2004/REC-xml11-20040204/#sec-xml11

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlnsoap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<terverVersionInfo MajorVersion="8" MinorVersion="1" MajorBuildNumber="263" MinorBuildNumber="0"
Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
</soap:Header>
<soap:Body>
<m:GetItemResponse
xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<m:ResponseMessages>
<m:GetItemResponseMessage ResponseClass="Success">
<m:ResponseCode>NoError</m:ResponseCode>
<m:Items>
<t:Message>
<t:ItemId Id="AAMkADllNTA4YmRjLTgxNTUtNDI3Ny1hZmJkLTU0ODU1NmE0OTAyZQBGAAAAAAChRyxXbJOzTbVl0M0I60jDBwBV+bBUA6OzRITxsDtfENDqAADMEyUvAABV+bBUA6OzRITxsDtfENDqACECYJ2QAAA="
ChangeKey="CQAAABYAAABV+bBUA6OzRITxsDtfENDqACECYhe0" />
<tarentFolderId
Id="AAMkADllNTA4YmRjLTgxNTUtNDI3Ny1hZmJkLTU0ODU1NmE0OTAyZQAuAAAAAAChRyxXbJOzTbVl0M0I60jDAQBV+bBUA6OzRITxsDtfENDqAADMEyUvAAA="
ChangeKey="AQAAAA==" />
<tubject>
[RealTime Service] Error has occured
</tubject>
<t:Body BodyType="Text">
thr ead:2424, process:1392, mem:28Mb,VM:28Mb Dump of exception type
'System.Data.SqlClient.SqlException'
Message: SQL Server does not exist or
access denied. Stack trace:
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&amp;isInTransaction)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean&amp; isIn Transaction)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteReader(DBCommandWrappercommand)
at AddOn.Configuration.ConfigurationManager.GetRtsSynchronization(GuidrtsId)
at AddOn.Configuration.ConfigurationManager.&#x1;(Object)

</t:Body>
<tateTimeReceived>
2008-06-12T03:10:07Z
</tateTimeReceived>
<t:Importance>Normal</t:Importance>
<t:IsDraft>false</t:IsDraft>
<tateTimeSent>
2008-06-12T03:08:18Z
</tateTimeSent>
<tateTimeCreated>
2008-06-12T03:10:07Z
</tateTimeCreated>
<t:HasAttachments>false</t:HasAttachments>
<t:ExtendedProperty>
<t:ExtendedFieldURI PropertyTag="0x6707"
PropertyType="String" />
<t:Value>
/Inbox/[RealTime Service] Error has occured-7.EML
</t:Value>
</t:ExtendedProperty>
<tender>
<t:Mailbox>
<t:Name>
sa-realtime@domain.com
</t:Name>
<t:EmailAddress>
sa-realtime@domain.com
</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
</t:Mailbox>
</tender>
<t:ToRecipients>
<t:Mailbox>
<t:Name>sysadm</t:Name>
<t:EmailAddress>
sysadm@domain.com
</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
</t:Mailbox>
</t:ToRecipients>
<t:From>
<t:Mailbox>
<t:Name>
sa-realtime@domain.com
</t:Name>
<t:EmailAddress>
sa-realtime@domain.com
</t:EmailAddress>
<t:RoutingType>SMTP</t:RoutingType>
</t:Mailbox>
</t:From>
<t:IsRead>false</t:IsRead>
</t:Message>
</m:Items>
</m:GetItemResponseMessage>
</m:ResponseMessages>
</m:GetItemResponse>
</soap:Body>
</soap:Envelope>

推荐答案

我目前有这个问题。我正在使用Exchange 2007 Web服务,从C#代码调用。您是否找到了解决此问题的方法?
我认为Web服务API会暴露一些我可以启用某些编码的属性。
I currently have this problem.  I am using Exchange 2007 Web Services, calling from C# code.  Have you found a solution to this issue?
I thought the web service API would expose some property where I could enable some encoding.


这篇关于包含无效XML字符的EWS响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆