none
serializing err of small part of SAP XML RRS feed

  • Question

  • Given the following WSDL (fragment) from an SAP server

          <xsd:complexType name="GenericPropertyTable">
            <xsd:sequence>
              <xsd:element name="Name" type="p1:PropertyName" />
              <xsd:element minOccurs="0" name="Namespace" type="p1:NamespaceURI" />
              <xsd:element minOccurs="0" maxOccurs="unbounded" name="ValueTableRow" type="p1:GenericTableRow" />
            </xsd:sequence>
          </xsd:complexType>
    
          <xsd:complexType name="GenericTableRow">
            <xsd:sequence>
              <xsd:element minOccurs="0" maxOccurs="unbounded" name="ValueTableCell" type="p1:GenericTableRowTableCell" />
            </xsd:sequence>
          </xsd:complexType>
    
          <xsd:complexType name="GenericTableRowTableCell">
            <xsd:sequence>
              <xsd:element name="ColumnName" type="p3:LANGUAGEINDEPENDENT_Name" />
              <xsd:element minOccurs="0" name="Value" type="p3:LANGUAGEINDEPENDENT_Text" />
            </xsd:sequence>
          </xsd:complexType>

    The following code is generated (VS 2010, .NET 4) when adding the service reference:

            /// <remarks/>
            [System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
            [System.Xml.Serialization.XmlArrayItemAttribute("ValueTableCell", typeof(GenericTableRowTableCell), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
            public GenericTableRowTableCell[][] ValueTableRow {
                get {
                    return this.valueTableRowField;
                }
                set {
                    this.valueTableRowField = value;
                    this.RaisePropertyChanged("ValueTableRow");
                }
            }
    
    

    Which generates an error if you try to use it:

    There was an error in serializing body of message QueryRequest: 'Unable to generate a temporary class (result=1).

    But you can fix that by changing the return type from 2D to 1D

    from this ---> public GenericTableRowTableCell[][] ValueTableRow {
    to this --->     public GenericTableRowTableCell[] ValueTableRow {

    The problem is when it process XML data it only gets the LAST 'valuetablerow'. Here is sample data that should produce two rows but results in only one valuetablerow. There are no errors thrown, and everything else works ok.

    What can I change to get all valuetablerows to be serialized?

              <ValueTableRow>
                <ValueTableCell>
                  <ColumnName>file.addConvParamName</ColumnName>
                  <Value>DirectDeposit_Struct.fieldFixedLengths</Value>
                </ValueTableCell>
                <ValueTableCell>
                  <ColumnName>file.addConvParamValue</ColumnName>
                  <Value>1000</Value>
                </ValueTableCell>
              </ValueTableRow>
              <ValueTableRow>
                <ValueTableCell>
                  <ColumnName>file.addConvParamName</ColumnName>
                  <Value>DirectDeposit_Struct.endSeparator</Value>
                </ValueTableCell>
                <ValueTableCell>
                  <ColumnName>file.addConvParamValue</ColumnName>
                  <Value>'nl'</Value>
                </ValueTableCell>
              </ValueTableRow>

    Wednesday, January 7, 2015 1:00 AM

Answers

All replies