I have already visited this post but it is not helpful as I do not have control over serialization.
Background: I have a WSDL document which I have added as a web reference and got a reference.cs class. I am calling a service from .Net application but it is throwing an error while deserializing. Following are my XML files one which works fine and other which is giving me an error.
Works fine:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:mas="http://orgname.com/compxref/Sometype">
<soapenv:Header/>
<soapenv:Body>
<mas:SomeInputType>
...............
Throwing Error:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<SomeInputType
xmlns="http://orgname.com/compxref/Sometype">
.........................
My serialization class looks like below:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.2612.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://orgname.com/compxref/Sometype")]
public partial class SomeInputType
{
...All the properties
}
Question: I want to change this XML to look like the one which is working fine. But here, I do not have control on serialization or deserialization. All I can do is to decorate Class and properties using data attributes.