C# Webservice Client Calculate each Security Header Element Independently
<p>I am trying to create a soap envelope manually and trying to create the security header like the following. Because of the strict namespace validations in the webservice server side the request is always failing with Invalid Security Header Error. Is there a way in C# .NET to form the entire Signature elements line by line. Following is the Output XML I am expecting.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soapenv:Envelope xmlns:oas1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:us:gov:treasury:irs:msg:irstransmitterstatusrequest" xmlns:urn1="urn:us:gov:treasury:irs:ext:aca:air:7.0" xmlns:urn2="urn:us:gov:treasury:irs:common" xmlns:urn3="urn:us:gov:treasury:irs:msg:acasecurityheader"&gt;
    &lt;soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;
        &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
            &lt;ds:Signature Id="SIG-E68EBBF1696C5DD4AA143353323390579" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&gt;
                &lt;ds:SignedInfo&gt;
                    &lt;ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" /&gt;
                    &lt;ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /&gt;
                    &lt;ds:Reference URI="#TS-82E7E6716E615C14D6144736030985954"&gt;
                        &lt;ds:Transforms&gt;
                            &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"&gt;
                                &lt;InclusiveNamespaces PrefixList="wsse wsa oas1 soapenv urn urn1 urn2 urn3" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                            &lt;/ds:Transform&gt;
                        &lt;/ds:Transforms&gt;
                        &lt;ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
                        &lt;ds:DigestValue&gt;[Digest_Value_Replaced]&lt;/ds:DigestValue&gt;
                    &lt;/ds:Reference&gt;
                    &lt;ds:Reference URI="#id-82E7E6716E615C14D6144736030986559"&gt;
                        &lt;ds:Transforms&gt;
                            &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"&gt;
                                &lt;InclusiveNamespaces PrefixList="oas1 soapenv urn1 urn2 urn3" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                            &lt;/ds:Transform&gt;
                        &lt;/ds:Transforms&gt;
                        &lt;ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
                        &lt;ds:DigestValue&gt;[Digest_Value_Replaced]&lt;/ds:DigestValue&gt;
                    &lt;/ds:Reference&gt;
                    &lt;ds:Reference URI="#id-82E7E6716E615C14D6144736030986558"&gt;
                        &lt;ds:Transforms&gt;
                            &lt;ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"&gt;
                                &lt;InclusiveNamespaces PrefixList="wsa oas1 soapenv urn1 urn2 urn3" xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                            &lt;/ds:Transform&gt;
                        &lt;/ds:Transforms&gt;
                        &lt;ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /&gt;
                        &lt;ds:DigestValue&gt;[Digest_Value_Replaced]&lt;/ds:DigestValue&gt;
                    &lt;/ds:Reference&gt;
                &lt;/ds:SignedInfo&gt;
                &lt;ds:SignatureValue&gt;[Signature_Value_Replaced]&lt;/ds:SignatureValue&gt;
                &lt;ds:KeyInfo Id="KI-82E7E6716E615C14D6144736030986456"&gt;
                    &lt;wsse:SecurityTokenReference wsu:Id="STR-82E7E6716E615C14D6144736030986457" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                        &lt;wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"&gt;[Cert_Value_Replaced]&lt;/wsse:KeyIdentifier&gt;
                    &lt;/wsse:SecurityTokenReference&gt;
                &lt;/ds:KeyInfo&gt;
            &lt;/ds:Signature&gt;
            &lt;wsu:Timestamp wsu:Id="TS-82E7E6716E615C14D6144736030985954"&gt;
                &lt;wsu:Created&gt;2016-03-23T09:53:23:55Z&lt;/wsu:Created&gt;
                &lt;wsu:Expires&gt;2016-03-23T10:03:23:55Z&lt;/wsu:Expires&gt;
            &lt;/wsu:Timestamp&gt;
        &lt;/wsse:Security&gt;
        &lt;urn:ACABusinessHeader wsu:Id="id-82E7E6716E615C14D6144736030986558" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
            &lt;urn1:UniqueTransmissionId&gt;uuid:SYS12:tcc_cd::T&lt;/urn1:UniqueTransmissionId&gt;
            &lt;urn2:Timestamp&gt;2016-03-23T09:53:23:55Z&lt;/urn2:Timestamp&gt;
        &lt;/urn:ACABusinessHeader&gt;
        &lt;urn3:ACASecurityHeader/&gt;
        &lt;wsa:Action&gt;RequestSubmissionStatusDetail&lt;/wsa:Action&gt;
    &lt;/soapenv:Header&gt;
    &lt;soapenv:Body&gt;
        &lt;urn:ACABulkRequestTransmitterStatusDetailRequest version="1.0" wsu:Id="id-82E7E6716E615C14D6144736030986559" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
            &lt;urn1:ACABulkReqTrnsmtStsReqGrpDtl&gt;
                &lt;urn2:ReceiptId&gt;[ReceiptId_Value_Replaced]&lt;/urn2:ReceiptId&gt;
            &lt;/urn1:ACABulkReqTrnsmtStsReqGrpDtl&gt;
        &lt;/urn:ACABulkRequestTransmitterStatusDetailRequest&gt;
    &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;
</code></pre>