How to add attributes to node

Nov 13 2017 5:46 PM
 
Hi all of you, I hope to be clear (sorry for my English).
 
I need to create the following soap xml.
 
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">  
  2.    <soapenv:Header/>  
  3.    <soapenv:Body>  
  4.       <tem:ventas>  
  5.          <!--Zero or more repetitions:-->  
  6.          <tem:venta attr1="?" attr2 ="?">  
  7.             <!--Zero or more repetitions:-->  
  8.             <tem:material attr1="?" attr2 ="?"/>  
  9.          </tem:venta>  
  10.       </tem:ventas>  
  11.    </soapenv:Body>  
  12. </soapenv:Envelope>  
I am writing a Service Contract like this: 
  1. namespace Arx2Casa  
  2. {  
  3.   
  4.     [DataContract]  
  5.     public class material   
  6.     {  
  7.         [XmlAttribute]  
  8.         public string attr1 { getset; }  
  9.         [XmlAttribute]  
  10.         public string attr2 { getset; }  
  11.     }   
  12.   
  13.     [ServiceContract]  
  14.     [XmlSerializerFormat]  
  15.     public interface Arx2CasaIntf   
  16.     {  
  17.         [OperationContract]  
  18.         string ventas(material[] venta);           
  19.     }  
  20.   
  21. }  
That contract generate the following REQUEST
 
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">  
  2.    <soapenv:Header/>  
  3.    <soapenv:Body>  
  4.       <tem:ventas>  
  5.          <!--Optional:-->  
  6.          <tem:venta>  
  7.             <!--Zero or more repetitions:-->  
  8.             <tem:material attr1="?" attr2="?"/>  
  9.          </tem:venta>  
  10.       </tem:ventas>  
  11.    </soapenv:Body>  
  12. </soapenv:Envelope>  
How do I add attibutes to <tem:venta> node?
 
Is there other way to do that?
 
Thanks for you support.
 
Regards