0

我们正在向 IRS 网站发送数据以提交 1094/1095C 表格。为了发送这个,我们创建了一个 HTTP 请求

   HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://la.www4.irs.gov/airp/aca/a2a/1095BC_Transmission_AATS2016");

            request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
            request.Headers.Add(HttpRequestHeader.ContentEncoding, "gzip");
            request.Headers.Add("Content-Transfer-Encoding", "8bit");
            request.Headers.Add("SOAPAction", "BulkRequestTransmitter");

            request.Method = "POST";

            request.Headers.Add("MIME-Version", "1.0");
            request.ContentType = "multipart/related; type=\"application/xop+xml;\" boundary=\"" + saperator+ "\";start=\"<root.message@cxf.apache.org>\"; start-info=\"text/xml\"\r\n";
            request.Headers.Add("Content-ID", "<root.message@cxf.apache.org>");
            request.Headers.Add("Payload", "--"+saperator);

并形成了最终请求

--uuid:bb8b365a-f8d6-49f0-9426-192c5408bf0f
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:us:gov:treasury:irs:ext:aca:air:7.0" xmlns:urn1="urn:us:gov:treasury:irs:common" xmlns:urn2="urn:us:gov:treasury:irs:msg:acabusinessheader">
          <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
          <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">
          .... signature part
          </wsse:Security>
            <urn:ACATransmitterManifestReqDtl wsu:Id="id-E68EBBF1696C5DD4AA143353323390577" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            .... Manifest data
            </urn:ACATransmitterManifestReqDtl>
            <urn2:ACABusinessHeader wsu:Id="id-E68EBBF1696C5DD4AA143353323390578" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            .... Business header 
            </urn2:ACABusinessHeader>
            <wsa:Action>BulkRequestTransmitter</wsa:Action>
          </soapenv:Header>
          <soapenv:Body>
            <urn:ACABulkRequestTransmitter version="1.0">
              <urn1:BulkExchangeFile>
                cid:1094C_Request_[TCCID]_20160312T161033882Z.xml
              </urn1:BulkExchangeFile>
            </urn:ACABulkRequestTransmitter>
          </soapenv:Body>
        </soapenv:Envelope>

        --uuid:bb8b365a-f8d6-49f0-9426-192c5408bf0f
        Content-Type: application/xml
        Content-Transfer-Encoding:7bit
        Content-ID:1094C_Request_[TCCID]_20160315T132809462Z.xml
        Content-Disposition: attachment; name="1094C_Request_[TCCID]_20160315T132809462Z.xml"
        <?xml version="1.0" encoding="UTF-8"?>
        <n1:Form109495CTransmittalUpstream xmlns:n1="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage" xmlns="urn:us:gov:treasury:irs:ext:aca:air:7.0" xmlns:irs="urn:us:gov:treasury:irs:common" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage IRS-Form1094-1095CTransmitterUpstreamMessage.xsd">
          .... Form109495CTransmittalUpstream data
        </n1:Form109495CTransmittalUpstream>
        --uuid:bb8b365a-f8d6-49f0-9426-192c5408bf0f--

但是当我们尝试使用上面的 HTTPRequest 时,得到错误

 <?xml version="1.0" encoding="UTF-8"?>
        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
            <soapenv:Body>
                <soapenv:Fault>
                    <faultcode>soapenv:Server</faultcode>
                    <faultstring>Error in assertion processing</faultstring>
                    <faultactor>ssg</faultactor>
                    <detail>
                        <l7:policyResult
                            status="Multipart stream ended before a terminating boundary was encountered" xmlns:l7="http://www.layer7tech.com/ws/policy/fault"/>
                    </detail>
                </soapenv:Fault>
            </soapenv:Body>
        </soapenv:Envelope>

你对此有任何参考,我们如何通过这个?或者如何在 .NET 中将文件作为 MTOM 附件发送?

4

2 回答 2

0

我相信其中一个问题(可能与您所经历的直接相关,也可能不直接相关)是您的价值

<urn1:BulkExchangeFile>

实际上应该是

<xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" 
             href="cid:1094C_Request_TCCID_20160312T161033882Z.xml" />
于 2016-03-16T22:20:40.637 回答
0

我遇到了与报告IRS ACA SOAP 边界错误相同的错误

尝试添加标头 Content-Encoding gzip。我曾向 IRS 询问过这个错误。以下是我得到的回复,可能对你有用。

• utf-8 must be in all caps UTF-8 for both the manifest and form data file 

• make sure your Timestamps follow these examples:

EXAMPLE (allow 10 minutes between create and expire:

<wsu:Timestamp wsu:Id="TS-9850525DA06CE28ED91448475206407141"> 

<wsu:Created>2015-11-25T18:13:26.407Z</wsu:Created> 

<wsu:Expires>2015-11-25T18:23:26.407Z</wsu:Expires> 

</wsu:Timestamp>

EXAMPLE:

<urn1:Timestamp>2015-07-09T13:41:09Z</urn1:Timestamp>
于 2016-03-16T17:21:31.680 回答