powered by simpleCommunicator - 2.0.40     © 2025 Programmizd 02
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Почему сгенерился такой класс по xsd
4 сообщений из 4, страница 1 из 1
Почему сгенерился такой класс по xsd
    #39184472
Pavluha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
XSD:
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
  <xs:element name="SenderProvidedRequestData">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="MessageID" type="basic:UUID">
          <xs:annotation>
            <xs:documentation>
                            Идентификатор, присвоенный сообщению отправителем.
                            Генерируется в соответствии с RFC-4122, по варианту 1 (на основании MAC-адреса и текущего времени).
                        </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element ref="basic:MessagePrimaryContent">
          <xs:annotation>
            <xs:documentation>Содержательная часть запроса, XML-документ.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" name="PersonalSignature" type="basic:XMLDSigSignatureType">
          <xs:annotation>
            <xs:documentation>
                            ЭП-СП содержательной части запроса.
                            Подписывается элемент, находящийся сразу под MessagePrimaryContent.
                            Хотя этот элемент не обязателен, поставщик данных может потребовать,
                            чтобы в запросах определённых типов ЭП-СП всегда была.
                            Это вызвано тем, что в ряде случаев, согласно ФЗ, сведения могут предоставляться только по запросам
                            должностных лиц определённого уровня.
                        </xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" ref="basic:AttachmentHeaderList">
          <xs:annotation>
            <xs:documentation>Заголовки вложенных файлов.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" ref="basic:RefAttachmentHeaderList">
          <xs:annotation>
            <xs:documentation>Заголовки файлов по ссылке.</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element minOccurs="0" name="BusinessProcessMetadata">
          <xs:annotation>
            <xs:documentation>
                            Информация о бизнес-процессе, в рамках которого пересылается данное сообщение.
                            Формат данных определяется в отдельной схеме (схемах).
                            На текущий эта информация не обязательна для заполнения отправителем.
                        </xs:documentation>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="strict" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" name="TestMessage" type="basic:Void">
          <xs:annotation>
            <xs:documentation>
                            Если этот элемент присутствует, то запрос - тестовый.
                            В этом случае, ИС-поставщик данных должна гарантировать, что её данные не будут изменены
                            в результате выполнения этого запроса.
                        </xs:documentation>
          </xs:annotation>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="Id" type="xs:ID" />
    </xs:complexType>
  </xs:element>
  <xs:element name="AttachmentHeaderList">
    <xs:annotation>
      <xs:documentation>
                Заголовки файлов, приложенных к СМЭВ-сообщению.
                Заголовки отделены от содержимого вложений.
                Это нужно потому, что заголовки должны попадать под ЭП-ОВ,
                а содержимое - должно не попадать (иначе не будет работать MTOM).
            </xs:documentation>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="AttachmentHeader" type="tns:AttachmentHeaderType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="AttachmentHeaderType">
    <xs:annotation>
      <xs:documentation>
                Файл, приложенный к СМЭВ-сообщению.
                Имя файла не передаётся; вложения идентифицируются только идентификаторами внутри сообщения.
            </xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="contentId" type="xs:string">
        <xs:annotation>
          <xs:documentation>
                        Идентификатор вложения. Ссылка на соответствующий //AttachmentContent/@Id
                    </xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="MimeType" type="tns:RFC2046MimeTypesType">
        <xs:annotation>
          <xs:documentation>Тип контента.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element minOccurs="0" name="SignaturePKCS7" type="xs:base64Binary">
        <xs:annotation>
          <xs:documentation>ЭЦП в формате PKCS#7 detached. Подписывать ключом ЭП-СП.</xs:documentation>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>



А получился класс такой:
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34281")]
    [System.SerializableAttribute()]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1")]
    public partial class SenderProvidedRequestData : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string messageIDField;
        
        private System.Xml.XmlElement messagePrimaryContentField;
        
        private System.Xml.XmlElement personalSignatureField;
        
        private AttachmentHeaderType[] attachmentHeaderListField;
        
        private RefAttachmentHeaderType[] refAttachmentHeaderListField;
        
        private SenderProvidedRequestDataBusinessProcessMetadata businessProcessMetadataField;
        
        private Void testMessageField;
        
        private string idField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=0)]
        public string MessageID {
            get {
                return this.messageIDField;
            }
            set {
                this.messageIDField = value;
                this.RaisePropertyChanged("MessageID");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Namespace="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1", Order=1)]
        public System.Xml.XmlElement MessagePrimaryContent {
            get {
                return this.messagePrimaryContentField;
            }
            set {
                this.messagePrimaryContentField = value;
                this.RaisePropertyChanged("MessagePrimaryContent");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=2)]
        public System.Xml.XmlElement PersonalSignature {
            get {
                return this.personalSignatureField;
            }
            set {
                this.personalSignatureField = value;
                this.RaisePropertyChanged("PersonalSignature");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("AttachmentHeaderList", typeof(AttachmentHeaderList), Namespace="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1", Order=3)]
        public AttachmentHeaderType[] AttachmentHeaderList {
            get {
                return this.attachmentHeaderListField;
            }
            set {
                this.attachmentHeaderListField = value;
                this.RaisePropertyChanged("AttachmentHeaderList");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute("RefAttachmentHeaderList", typeof(RefAttachmentHeaderList), Namespace="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1", Order=4)]
        public RefAttachmentHeaderType[] RefAttachmentHeaderList {
            get {
                return this.refAttachmentHeaderListField;
            }
            set {
                this.refAttachmentHeaderListField = value;
                this.RaisePropertyChanged("RefAttachmentHeaderList");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=5)]
        public SenderProvidedRequestDataBusinessProcessMetadata BusinessProcessMetadata {
            get {
                return this.businessProcessMetadataField;
            }
            set {
                this.businessProcessMetadataField = value;
                this.RaisePropertyChanged("BusinessProcessMetadata");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=6)]
        public Void TestMessage {
            get {
                return this.testMessageField;
            }
            set {
                this.testMessageField = value;
                this.RaisePropertyChanged("TestMessage");
            }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlAttributeAttribute(DataType="ID")]
        public string Id {
            get {
                return this.idField;
            }
            set {
                this.idField = value;
                this.RaisePropertyChanged("Id");
            }
        }
        
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        
        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }



Не должно ли быть свойство AttachmentHeaderList типа AttachmentHeaderList?
...
Рейтинг: 0 / 0
Почему сгенерился такой класс по xsd
    #39184513
ViPRos
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Pavluha,

нет
...
Рейтинг: 0 / 0
Почему сгенерился такой класс по xsd
    #39184814
Pavluha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
ViPRos,

Сериализация не проходит. Пишет не может преобразовать тип AttachmentHeaderType в AttachmentHeaderList

А это прописано тут:
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
 [System.Xml.Serialization.XmlElementAttribute("AttachmentHeaderList", typeof(AttachmentHeaderList), Namespace="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/basic/1.1", Order=3)]
        public AttachmentHeaderType[] AttachmentHeaderList {
            get {
                return this.attachmentHeaderListField;
            }
            set {
                this.attachmentHeaderListField = value;
                this.RaisePropertyChanged("AttachmentHeaderList");
            }
        }



Разве это нормально?
...
Рейтинг: 0 / 0
Почему сгенерился такой класс по xsd
    #39184844
Фотография Axeleron
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
PavluhaРазве это нормально?
Наверное, да, когда идет явное преобразование одного типа в другой...
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / WCF, Web Services, Remoting [игнор отключен] [закрыт для гостей] / Почему сгенерился такой класс по xsd
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]