Answered by:
XML deserialization is changing one node to i:type=“a:ArrayOfXmlNode”

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
- Moved by Xingyu ZhaoMicrosoft contingent staff Thursday, July 2, 2020 7:42 AM
Thursday, July 2, 2020 12:49 AM
Answers
-
Then I'd try them over here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.
- Edited by Dave PatrickMVP Thursday, July 2, 2020 1:50 PM
- Marked as answer by Guido Franzke Thursday, July 9, 2020 6:12 AM
Thursday, July 2, 2020 1:50 PM -
I'd try rewording the question leaving out the postman references otherwise they'll toss it again.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Dave PatrickMVP Monday, July 6, 2020 12:18 PM
- Marked as answer by Guido Franzke Thursday, July 9, 2020 6:12 AM
Thursday, July 2, 2020 1:57 PM
All replies
-
Hi DavidThi808,
Thank you for posting here.
In order to help you find the correct forum to go ask questions, I have moved the thread to where is the forum for forum.
Thank you for your understanding.
Best Regards,
Xingyu Zhao
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Thursday, July 2, 2020 7:42 AM -
I'd try asking for help over here.
https://community.postman.com/
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Guido Franzke Thursday, July 2, 2020 9:54 AM
- Unproposed as answer by DavidThielen Thursday, July 2, 2020 12:18 PM
Thursday, July 2, 2020 7:46 AM -
This is not a Postman question - it's a .Net library XML serialization question.
Please move it back.
What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing
Thursday, July 2, 2020 12:18 PM -
THis is not a postman question. I am just using postman to show that the XML deserialization in the .Net Library is doing something weird.
What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing
Thursday, July 2, 2020 12:19 PM -
Might try them over here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wcf
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.Thursday, July 2, 2020 12:43 PM -
It's a .Net runtime engine question.
What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing
Thursday, July 2, 2020 1:45 PM -
Then I'd try them over here.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=vslanguages
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.
- Edited by Dave PatrickMVP Thursday, July 2, 2020 1:50 PM
- Marked as answer by Guido Franzke Thursday, July 9, 2020 6:12 AM
Thursday, July 2, 2020 1:50 PM -
I did and Xingyu Zhao moved it over here. I think he/she did not understand the basis of the question.
I'm trying to get them to move it back.
What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing
Thursday, July 2, 2020 1:55 PM -
I'd try rewording the question leaving out the postman references otherwise they'll toss it again.
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Dave PatrickMVP Monday, July 6, 2020 12:18 PM
- Marked as answer by Guido Franzke Thursday, July 9, 2020 6:12 AM
Thursday, July 2, 2020 1:57 PM