首页 > 解决方案 > 尝试通过 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”类型

标签: apisabre

解决方案


发生这种情况是因为序列化程序不知道要转换为哪种类型,因为引发错误的类型可能不止一种。我认为这简化了 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;
        }
    }
}

推荐阅读