Click here to Skip to main content
15,039,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want write C# classes, so that when I am serialize them in to XML, it should generate the following XML schema.

XML
<soapenv:Envelope
            xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:web="http://webservice.api.cabaret.com/"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <soapenv:Header/>
   <soapenv:Body>
      <web:callArgs>
         <name></name>
         <args>
            <entries>
               <name>locator.content</name>
               <value xsi:type="xs:string">AA==</value>
            </entries>
            <entries>
               <name>locator.name</name>
               <value xsi:type="xs:string">Reha0850.pdf</value>
            </entries>
         </args>
      </web:callArgs>
   </soapenv:Body>
</soapenv:Envelope>


Please provide me the help, how should i write the c# classes and serialize them to generate above mentioned XML schema.

What I have tried:

I tried lot by defining the classes and serialize them, but I do not get the exact schema what I am expecting.
Posted
Updated 10-Mar-16 21:44pm

1 solution

Did you have a look into the XmlSerializer Class? XML Schema Definition Tool (Xsd.exe) should be able to create classes from your schema that are serialized into documents at runtime.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900