Ошибка при попытке доступа к профилю через код .net на сабле ProfileReadRQ - PullRequest
0 голосов
/ 30 января 2019

Когда мы пытаемся получить доступ к профилю с помощью кода, мы получаем сообщение, как показано ниже, советуем

Ошибка:

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.BusinessSystemIdentityInfoSynchronizationCriterionTypeExcludeCombination'

1008 *

1 Ответ

0 голосов
/ 06 февраля 2019

Это происходит потому, что сериализатор не знает, к какому типу приводиться, так как типы, которые выдают ошибку, могут иметь более одного типа.Я думаю, что это упрощает XML, но усложняет WSDL / .NET.Я, вероятно, говорю это не совсем точно, но в этом суть, по крайней мере, насколько я понимаю.

Вы можете зайти в свой файл reference.cs, удалить сериализацию для этих полей и попробовать еще раз.Я делал это в прошлом с некоторым успехом.Если / когда вы обновите версию API новым файлом WSDL, вам придется помнить, что нужно делать это снова, поэтому это не идеальное решение.У меня есть пример того, что я удалил из моего файла 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;
        }
    }
}
...