I am given task to convert SOAP request to ReST JSON and then JSON back to SOAP XML. I have done the part of converting SOAP to JSON with Serialize and XMlElement() classes. Now the trickiest part comes where I need to convert JSON to SOAP. There are our own namespaces which are written and I want to put those namespaces back as well when converting JSON to SOAP XML. For example,
<asr:APIRequest
xmlns:guid-"http://Some-test-namespace.xsd" xmlns:xsi="https://www.w3.org/2001/XMLSchema" xmins:asw="http://Some-test-namespace.xsd" xmIns:ar="http://Some-test-namespace.xsd" xmlns:asr="http://Some-test-namespace.xsd">
<asr:APIRequestDetails>
<ar:Individual>
<ar:IndividualKey>3791239123-123123123-1231231</ar:IndividualKey>
</ar:Individual>
</asr:APIRequestDetails>
</asr:APIRequest>
I converted it to JSON
{
"APIRequest": {
"APIRequestDetails": {
"Individual": {
"IndividualKey": "3791239123-123123123-1231231"
}
}
}
}
Now I want to convert it back to SOAP XML with the namespaces that are attached such as 'asr', 'ar'. I am using C# .Net Core and used XDocument, XMLSerializer for converting XML to JSON.
can anyone please help me converting JSON back to SOAP XML with the NAMESPACES as well?