locked
XML deserialization is changing one node to i:type=“a:ArrayOfXmlNode” RRS feed

  • Question

  • I use Postman to send a request to my RESTful server. What I send is the following:

    <Template>
        <ConnectionString>http://localhost:81/Template/InputParameters.docx</ConnectionString>
        <OutputFormat>docx</OutputFormat>
        <Parameters>
            <Parameter>
                <Name>Text</Name>
                <Value>Support \nnewline character \n\tfor text input parameter</Value>
            </Parameter>
        </Parameters>
        <Datasources>
            <Datasource>
                <Name>test</Name>
                <Type>xml2</Type>
                <ConnectionString>http://localhost:81/Template/SouthWind.xml</ConnectionString>
            </Datasource>
        </Datasources>
    </Template>
    But what I get on the server side is:

    <?xml version="1.0" encoding="utf-8"?>
    <Template xmlns="http://schemas.datacontract.org/2004/07/RESTfulEngine.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <Callback i:nil="true"/>
        <ConnectionString>http://localhost:81/Template/InputParameters.docx</ConnectionString>
        <Data i:nil="true"/>
        <Datasources>
            <Datasource>
                <ClassName i:nil="true"/>
                <ConnectionString>http://localhost:81/Template/SouthWind.xml</ConnectionString>
                <Data i:nil="true"/>
                <Datasets/>
                <Name>test</Name>
                <SchemaConnectionString i:nil="true"/>
                <SchemaData i:nil="true"/>
                <Type>xml2</Type>
            </Datasource>
        </Datasources>
        <EngineVersion i:nil="true"/>
        <FirstPagePrinter i:nil="true"/>
        <Format i:nil="true"/>
        <Guid>d59e1ae8-4def-437f-a860-4a93723587f6</Guid>
        <LicenseFromHeader i:nil="true"/>
        <MainPrinter i:nil="true"/>
        <OutputFormat>docx</OutputFormat>
        <Parameters>
            <Parameter>
                <Name>Text</Name>
                <Value i:type="a:ArrayOfXmlNode" xmlns:a="http://schemas.datacontract.org/2004/07/System.Xml"/>
            </Parameter>
        </Parameters>
    </Template>
    The array of Datasource works fine. But the array pf Parameters is giving we something real weird for the node.

    The actual class on the server side is:

    public class Parameter { /// Initializes a new instance of the class. public Parameter(string name, object value) { Name = name; Value = value; }

    /// <summary>For the ASP.NET constructor for controllers.</summary>
    public Parameter()
    {
    }

    /// <summary>
    /// Name of the parameter (the var in ${var}).
    /// </summary>
    [DataMember]
    public string Name { get; set; }

    /// <summary>
    /// The Value of the parameter.
    /// </summary>
    [DataMember]
    public object Value { get; set; }
    }

    What's going on here?

    thanks - dave



    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Thursday, July 2, 2020 12:49 AM

Answers

All replies