title: how to serialize an object in soap format and add prefixes
body: <p>I have an object and iam serilaizing the object using xml seriliazer.
  after serilaizing my data looks like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;doPaymentRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  &lt;Credentials&gt;
  &lt;accountId&gt;101&lt;/accountId&gt;
  &lt;userName&gt;santosh@gmail.com&lt;/userName&gt;
  &lt;password&gt;1234&lt;/password&gt;
  &lt;/Credentials&gt;
  &lt;custFirstName&gt;santosh&lt;/custFirstName&gt;
  &lt;custLastName&gt;reddy&lt;/custLastName&gt;
  &lt;ssn&gt;1234&lt;/ssn&gt;
  &lt;phoneNbr&gt;1234567890&lt;/phoneNbr&gt;
  &lt;PaymentRequest&gt;
  &lt;ncpTranCode&gt;10104587&lt;/ncpTranCode&gt;
  &lt;tranType&gt;PAY&lt;/tranType&gt;
  &lt;Payment&gt;
    &lt;tranAmount&gt;100&lt;/tranAmount&gt;
    &lt;paymentDateDate&gt;2013-04-30&lt;/paymentDateDate&gt;
    &lt;tenderType&gt;C&lt;/tenderType&gt;
  &lt;/Payment&gt;
  &lt;/PaymentRequest&gt;
   &lt;csoId&gt;203&lt;/csoId&gt;
   &lt;csoStCode&gt;8974&lt;/csoStCode&gt;
   &lt;/doPaymentRequest&gt;
  </code></pre>
  
  <p>But my xml should look like this way</p>
  
  <pre><code>   &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"   xmlns:req="http://xxxxxxxxxxxx" xmlns:com="http://xxxxxxxxxxxxxxxxxx"&gt;
               &lt;soapenv:Header/&gt;
                   &lt;soapenv:Body&gt;
                   &lt;req:doPaymentRequest&gt;
      &lt;req:credentials&gt;
       &lt;com:accountId&gt;*********&lt;/com:accountId&gt;
        &lt;com:userName&gt;*********&lt;/com:userName&gt;
         &lt;com:password&gt;*********&lt;/com:password&gt;
               &lt;/req:credentials&gt;
                  &lt;req:custFirstName&gt;Test&lt;/req:custFirstName&gt;
                 &lt;!-- Optional: --&gt;
                   &lt;req:custMiddleName&gt;Test&lt;/req:custMiddleName&gt;
                     &lt;req:custLastName&gt;Test&lt;/req:custLastName&gt;
                   &lt;req:ssn&gt;7895&lt;/req:ssn&gt;
                   &lt;!-- Optional: --&gt;
                &lt;req:phoneNbr&gt;1234567890&lt;/req:phoneNbr&gt;
                     &lt;req:paymentRequest&gt;
                      &lt;req:ncpTranCode&gt;10104587&lt;/req:ncpTranCode&gt;
                   &lt;req:tranType&gt;PAY&lt;/req:tranType&gt;
                            &lt;req:payment&gt;
                          &lt;req:tranAmount&gt;100&lt;/req:tranAmount&gt;
                           &lt;req:paymentDateDate&gt;2013-04-30&lt;/req:paymentDateDate&gt;
                               &lt;req:tenderType&gt;C&lt;/req:tenderType&gt;
                                &lt;/req:payment&gt;
                              &lt;/req:paymentRequest&gt;
                            &lt;req:csoId&gt;203&lt;/req:csoId&gt;
                               &lt;req:csoStCode&gt;8974&lt;/req:csoStCode&gt;
                     &lt;/req:doPaymentRequest&gt;
                 &lt;/soapenv:Body&gt;
                   &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>How to add prefixes like req,com.
  I am using XmlSerializer to convert my object to xml.
      xmlSerializer.Serialize(stWriter, myobject);</p>
  
  <p>is there any SOAP serialize like thing
  ............Edited.............
  I used  SoapFormatter and serialized the object and converting it to string using<br>
           Encoding.ASCII.GetString(memStream.GetBuffer())</p>
  
  <p>then my string looks weird like following.</p>
  
  <pre><code>  &lt;SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
            &lt;SOAP-ENV:Body&gt;
                  &lt;i2:doPaymentRequest id="ref-1" xmlns:i2="http://schemas.xmlsoap.org/soap/envelope/"&gt;
           &lt;_x003C_Credentials_x003E_k__BackingField href="#ref-4"/&gt;
            &lt;_x003C_custFirstName_x003E_k__BackingField id="ref-      5"&gt;santosh&lt;/_x003C_custFirstName_x003E_k__BackingField&gt;
           &lt;_x003C_custMiddleName_x003E_k__BackingField xsi:null="1"/&gt;
             &lt;_x003C_custLastName_x003E_k__BackingField id="ref-  6"&gt;reddy&lt;/_x003C_custLastName_x003E_k__BackingField&gt;
           &lt;_x003C_ssn_x003E_k__BackingField id="ref-7"&gt;1234&lt;/_x003C_ssn_x003E_k__BackingField&gt;
              &lt;_x003C_phoneNbr_x003E_k__BackingField id="ref-  8"&gt;1234567890&lt;/_x003C_phoneNbr_x003E_k__BackingField&gt;
             &lt;_x003C_PaymentRequest_x003E_k__BackingField href="#ref-9"/&gt;
              &lt;_x003C_csoId_x003E_k__BackingField id="ref-  10"&gt;203&lt;/_x003C_csoId_x003E_k__BackingField&gt;
              &lt;_x003C_csoStCode_x003E_k__BackingField id="ref-  11"&gt;8974&lt;/_x003C_csoStCode_x003E_k__BackingField&gt;
            &lt;/i2:doPaymentRequest&gt;
                &lt;a1:credentials id="ref-4"   xmlns:a1="http://schemas.microsoft.com/clr/nsassem/MemoService/MemoService%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"&gt;
               &lt;_x003C_accountId_x003E_k__BackingField id="ref- 12"&gt;101&lt;/_x003C_accountId_x003E_k__BackingField&gt;
               &lt;_x003C_userName_x003E_k__BackingField id="ref-13"&gt;santosh@gmail.com&lt;/_x003C_userName_x003E_k__BackingField&gt;
                &lt;_x003C_password_x003E_k__BackingField id="ref-14"&gt;1234&lt;/_x003C_password_x003E_k__BackingField&gt;
             &lt;/a1:credentials&gt;
                &lt;a1:paymentRequest id="ref-9"   xmlns:a1="http://schemas.microsoft.com/clr/nsassem/MemoService/MemoService%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"&gt;
                 &lt;_x003C_ncpTranCode_x003E_k__BackingField id="ref-  15"&gt;10104587&lt;/_x003C_ncpTranCode_x003E_k__BackingField&gt;
              &lt;_x003C_tranType_x003E_k__BackingField id="ref-  16"&gt;PAY&lt;/_x003C_tranType_x003E_k__BackingField&gt;
               &lt;_x003C_Payment_x003E_k__BackingField href="#ref-17"/&gt;
                  &lt;/a1:paymentRequest&gt;
                  &lt;a1:payment id="ref-17" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/MemoService/MemoService%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull"&gt;
                &lt;_x003C_tranAmount_x003E_k__BackingField id="ref- 18 "&gt;100&lt;/_x003C_tranAmount_x003E_k__BackingField&gt;
                 &lt;_x003C_paymentDateDate_x003E_k__BackingField id="ref-19"&gt;2013-04-
  
              30&lt;/_x003C_paymentDateDate_x003E_k__BackingField&gt;
                  &lt;_x003C_tenderType_x003E_k__BackingField id="ref-  
  
               20"&gt;C&lt;/_x003C_tenderType_x003E_k__BackingField&gt;
            &lt;/a1:payment&gt;
               &lt;/SOAP-ENV:Body&gt;
                   &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>Am i missing anything here...</p>