'Require same default xml namespace for parent and child element on serialization
I would like the parent and child element to have the same default namespace. I require this way because the serialized xml at the other end appears like that where the digital signature is being verified.
[XmlType("Parent", Namespace = "some-default-namespace")]
public class Parent
{
[XmlElement("ChildOne", Namespace = "some-default-namespace", Order = 0)]
public Child1 child1 { get; set; }
[XmlElement("ChildTwo", Namespace = "some-default-namespace", Order = 1)]
public Child2 child2 { get; set; }
}
On XML Serialize I get this ...
<Parent xmlns="some-default-namespace">
<ChildOne>
...
</ChildOne>
<ChildTwo>
...
</ChildTwo>
</Parent>
Now, if I sign this XML and send the signed xml as the SOAP payload, this SOAP request payload gets deserialized into JAVA object and in the actual webservice method as part of the process, they serialize the JAVA object into xml to verify the digital signature. Their serialized xml looks as below, for whatever reason. That is why I would like to sign the xml that I have control over in the form as below
<Parent xmlns="some-default-namespace">
<ChildOne xmlns="some-default-namespace">
...
</ChildOne>
<ChildTwo xmlns="some-default-namespace">
...
</ChildTwo>
</Parent>
how can I get the desired output? any help is much appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
