Invalid WS Security Header - IRS ACA SOAP Request
<p>I'm in the process of submitting a <code>RequestSubmissionStatusDetail</code> request from the IRS.</p>

<p>Here's my problem. When submitting the following document to the IRS, I always get "Invalid WS Security Header". I do not know which part of my request is responsible for this submission not to be successful.</p>

<p>I'm referencing the <a href="https://www.irs.gov/PUP/for_taxpros/software_developers/information_returns/AIR_Composition_and_Reference_Guide.pdf" rel="noreferrer">following PDF (example code starts on page 35)</a>:</p>

<p>I've written the code in both VB and C#. I've intercepted the request with Fiddler, and also used Altova XMLSpy to send raw XML requests to the IRS endpoint.</p>

<p>Here's the code, pretty much line by line from the PDF, minus the key and the TCC.</p>

<pre><code>    POST https://la.www4.irs.gov/airp/aca/a2a/1095BC_Status_Request_AATS2016 HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    VsDebuggerCausalityData: uIDPo1urdU71mo5BnU/TZ/Ji3p0AAAAAddUwh6B4CU6+F/jOewcN7JE6Ql8n+R1PofxFBfDEEg4ACQAA
    SOAPAction: "RequestSubmissionStatusDetail"
    Host: la.www4.irs.gov
    Content-Length: 4044
    Expect: 100-continue
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive

    &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-82E7E6716E615C14D6144736030986660" 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-82E7E6716E615C14D6144736030986559"&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;sgPiL73lIwOppVKHHUFkuWDEcLM=&lt;/ds:DigestValue&gt;
                            &lt;!-- DigestValue from Timestamp --&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;S3OdSc3rZ8V1egoyPGzi31n8gq8=&lt;/ds:DigestValue&gt;        
                            &lt;!-- DigestValue from ACABusinessHeader --&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;wOSkrI5NmQ5i5/wgjNEIoNODy+A=&lt;/ds:DigestValue&gt;       
                            &lt;!-- DigestValue from ACABulkRequestTransmitterStatusDetailRequest --&gt;      
                        &lt;/ds:Reference&gt;     
                    &lt;/ds:SignedInfo&gt;    
                    &lt;ds:SignatureValue&gt;ddLCWffcBk5/PxqnJLMUM9lWWYWX7ucKQ4vPvM/qEj9IkJ0SVDytcjn0Az9Cge0nxOHI0NWCtAzbWzcUjHtUgt8A4rnxTTShQbIP3hPIX5UghS/Y6OEvOq8RvXL1S3R8nhX/nPrQSoPq6SpEz2HKq/ST5OrsstMvSpM0hCCinEKeLmLqkjfZw5wZVEeNwQIjghcsqQe7Q9crYhgdDwuvtixcoLw0JCgCiMr9yCmFsV4X+CklPuu4/bMUcuipE5fnSpqoZ6Sxp+UFlF3yzMXH6hKFRO7LRsXtwStN1kBwPJW5iPZ6b+X0Zlrc7gYTg1dHi3kcm3gLCRQ9ou+fZa7jnQ==&lt;/ds:SignatureValue&gt;    
                    &lt;ds:KeyInfo Id="KI-82E7E6716E615C14D6144736030986456"&gt;    
                        &lt;wsse:SecurityTokenReference wsu:Id="STR-82E7E6716E615C14D6144736030986457"&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-profile1.0#X509v3"&gt;
                                removed
                            &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-01-07T20:31:49.859Z&lt;/wsu:Created&gt;     
                    &lt;wsu:Expires&gt;2016-01-07T23:01:49.859Z&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;d4121eb6-29e8-4ebe-a485-0b2bf55fcb67:SYS12:XXXXX::T&lt;/urn1:UniqueTransmissionId&gt;    
                &lt;urn2:Timestamp&gt;2016-01-07T15:31:49Z&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;1094B-15-99700283&lt;/urn2:ReceiptId&gt;    
            &lt;/urn1:ACABulkReqTrnsmtStsReqGrpDtl&gt;   
            &lt;/urn:ACABulkRequestTransmitterStatusDetailRequest&gt;  
        &lt;/soapenv:Body&gt; 
    &lt;/soapenv:Envelope&gt;             
</code></pre>