api - 尝试通过 sabre ProfileReadRQ 上的 .net 代码访问配置文件时出错
问题描述
当我们尝试通过代码访问个人资料时,我们收到如下消息,请告知
错误是:
There was an error in serializing one of the headers in message
EPS_ProfileReadRQRequest: 'Unable to generate a temporary class (result=1).
错误 CS0030:无法将类型“CRM.ProfileReadRQ.BusinessSystemIdentityInfoSynchronizationCriterionTypeExcludeCombination”转换为“CRM.ProfileReadRQ.BusinessSystemIdentityInfoSynchronizationCriterionTypeIncludeCombination”错误 CS0029:无法将类型“CRM.ProfileReadRQ.BusinessSystemIdentityInfoSynchronizationCriterionTypeIncludeCombination”隐式转换为“CRM.ProfileReadRQ.BusinessSystemIdentityInfoSynchronizationCriterionTypeIncludeCombination”类型
解决方案
发生这种情况是因为序列化程序不知道要转换为哪种类型,因为引发错误的类型可能不止一种。我认为这简化了 XML,但它使 WSDL/.NET 的东西更加复杂。我可能没有说得完全准确,但这就是它的要点,至少据我所知。
您可以进入您的 reference.cs 文件并删除那些违规字段的序列化,然后重试。我过去做过这件事并取得了一些成功。但是,如果/当您使用新的 WSDL 文件更新 API 版本时,您必须记住再次执行此操作,因此这不是一个完美的解决方案。我已经从我的 reference.cs 文件中删除了一个示例,以获取下面的配置文件 API 之一,希望它会有所帮助。
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.sabre.com/eps/schemas")]
public partial class BusinessSystemIdentityInfoSynchronizationCriterionType {
private BusinessSystemIdentityInfoSynchronizationCriterionTypeExcludeCombination[] itemsField;
private ItemsChoiceType1[] itemsElementNameField;
//remarked this out 12/24/18 - these include/exclude combinations do not serialize correctly for some reason
/// <remarks/>
//[System.Xml.Serialization.XmlElementAttribute("ExcludeCombination", typeof(BusinessSystemIdentityInfoSynchronizationCriterionTypeExcludeCombination))]
//[System.Xml.Serialization.XmlElementAttribute("IncludeCombination", typeof(BusinessSystemIdentityInfoSynchronizationCriterionTypeIncludeCombination))]
//[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
//public BusinessSystemIdentityInfoSynchronizationCriterionTypeExcludeCombination[] Items {
// get {
// return this.itemsField;
// }
// set {
// this.itemsField = value;
// }
//}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("ItemsElementName")]
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemsChoiceType1[] ItemsElementName {
get {
return this.itemsElementNameField;
}
set {
this.itemsElementNameField = value;
}
}
}
推荐阅读
- css - SCSS 可以检测容器的 2 个子元素是放在同一行还是分成 2 行?
- python - 函数未按预期运行 - 2 个参数,检查 bool 是否为 True
- java - JAVA程序计算从0开始可以被3整除的前n个偶数的总和并打印总和
- javascript - 如何修复“无法读取未定义的属性‘setAttribute’”
- google-fabric - 是否可以从 Fabric Api 检索事件信息?
- matlab - 如何使用矩阵在每个元素中存储一个向量
- git - Git squash 特定的提交
- python - Numpy 随机选择具有生成具有唯一行的二维数组的概率
- analytics - 读取 U-SQL 中提取模式中的重复指标
- javascript - 剑道确认与剑道警报重叠