IRS-A2A "message was not formatted properly" (TPE1105 - uniqueTransmissionID)

IRS-A2A "message was not formatted properly" (TPE1105 - uniqueTransmissionID)

我正在使用 WCF 通过他们的 WSDL 为 IRS 集成 A2A 通道。我能够通过发送请求的任何与代码相关的错误,但目前从 IRS 收到以下错误:

<faultstring>The message was not formatted properly and/or cannot be interpreted. Please review the XML standards outlined in Section 3 of Publication 5258 (...), correct any issues, and try again.</faultstring>
<detail>
    <errorcode>TPE1105</errorcode>
    <uniqueTransmissionID/>
</detail>

我假设基于响应中 <uniqueTransmissionID/> 的附加节点它与 UTID 有关。我无数次查看了 UTID 和 Soap Envelope 示例的格式,但终究无法找出可能不合适的地方。我尝试了 fatherOfWine 在 previous answer 中提出的一个小建议,将业务 Header 移到清单之上,但它 returns 同样的错误。

我已经用 Soap Envelope 添加了完整的请求,空白似乎在请求期间被去除了,但我 re-formatted 它来自 Fiddler。

POST [AATS URL] HTTP/1.1
Content-Type: multipart/related; type="application/xop+xml";start="<rootpart>";start-info="text/xml";boundary="--023e657d-66f5-4e92-8e6e-c223338c205a"
SOAPAction: "BulkRequestTransmitter"
Host: la.www4.irs.gov
Content-Length: 15820
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive


----023e657d-66f5-4e92-8e6e-c223338c205a
Content-Type: application/xop+xml; type="text/xml"; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Id:<rootpart>

<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:ext:aca:air:ty18" 
    xmlns:urn1="urn:us:gov:treasury:irs:common" 
    xmlns:urn2="urn:us:gov:treasury:irs:msg:acabusinessheader" 
    xmlns:urn3="urn:us:gov:treasury:irs:msg:acasecurityheader" 
    xmlns:urn4="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter">
    <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 Id="SIG-E508633998DD41B6AE062D27D0AC9A48" 
                xmlns="http://www.w3.org/2000/09/xmldsig#">
                <SignedInfo>
                    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" />
                    <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
                    <Reference URI="#TS-BAC31544F1954B5F8C8441167B91A388">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsse wsa oas1 soapenv urn urn1 urn2 urn3 urn4" 
                                    xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[VALUE]</DigestValue>
                    </Reference>
                    <Reference URI="#id-870747663BAB4D6FB43FFAD2034013F1">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsa oas1 soapenv urn1 urn2 urn3 urn4" 
                                    xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[VALUE]</DigestValue>
                    </Reference>
                    <Reference URI="#id-1A336736A6134B16831D45A0C8785D10">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsa oas1 soapenv urn urn1 urn3 urn4" 
                                    xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[VALUE]</DigestValue>
                    </Reference>
                </SignedInfo>
                <SignatureValue>[VALUE]</SignatureValue>
                <KeyInfo Id="KI-42CB9363E8BE47F2B3E0CD8A743C2D7C">
                    <wsse:SecurityTokenReference wsu:Id="STR-9EE1B09DD6794A64B00B496CC9DC3804">
                        <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">[KEY]</wsse:KeyIdentifier>
                    </wsse:SecurityTokenReference>
                </KeyInfo>
            </Signature>
            <wsu:Timestamp wsu:Id="TS-BAC31544F1954B5F8C8441167B91A388">
                <wsu:Created>2018-12-27T17:42:39.593Z</wsu:Created>
                <wsu:Expires>2018-12-27T17:52:39.593Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
        <urn:ACATransmitterManifestReqDtl wsu:Id="id-DB1DDC6A020C433CB71FF38200026E55" 
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <urn:PaymentYr>2018</urn:PaymentYr>
            <urn:PriorYearDataInd>0</urn:PriorYearDataInd>
            <urn1:EIN>[EIN]</urn1:EIN>
            <urn:TransmissionTypeCd>O</urn:TransmissionTypeCd>
            <urn:TestFileCd>T</urn:TestFileCd>
            <urn:TransmitterNameGrp>
                <urn:BusinessNameLine1Txt>[Name]</urn:BusinessNameLine1Txt>
            </urn:TransmitterNameGrp>
            <urn:CompanyInformationGrp>
                <urn:CompanyNm>[Name]</urn:CompanyNm>
                <urn:MailingAddressGrp>
                    <urn:USAddressGrp>
                        <urn:AddressLine1Txt>[Address]</urn:AddressLine1Txt>
                        <urn1:CityNm>[City]</urn1:CityNm>
                        <urn:USStateCd>[ST]</urn:USStateCd>
                        <urn1:USZIPCd>[ZIP]</urn1:USZIPCd>
                    </urn:USAddressGrp>
                </urn:MailingAddressGrp>
                <urn:ContactNameGrp>
                    <urn:PersonFirstNm>[FirstName]</urn:PersonFirstNm>
                    <urn:PersonLastNm>[LastName]</urn:PersonLastNm>
                </urn:ContactNameGrp>
                <urn:ContactPhoneNum>[PhoneNumber]</urn:ContactPhoneNum>
            </urn:CompanyInformationGrp>
            <urn:VendorInformationGrp>
                <urn:VendorCd>I</urn:VendorCd>
                <urn:ContactNameGrp>
                    <urn:PersonFirstNm>[FirstName]</urn:PersonFirstNm>
                    <urn:PersonLastNm>[LastName]</urn:PersonLastNm>
                </urn:ContactNameGrp>
                <urn:ContactPhoneNum>[PhoneNumber]</urn:ContactPhoneNum>
            </urn:VendorInformationGrp>
            <urn:TotalPayeeRecordCnt>3</urn:TotalPayeeRecordCnt>
            <urn:TotalPayerRecordCnt>1</urn:TotalPayerRecordCnt>
            <urn:SoftwareId>[SoftwareID]</urn:SoftwareId>
            <urn:FormTypeCd>1094/1095C</urn:FormTypeCd>
            <urn1:BinaryFormatCd>application/xml</urn1:BinaryFormatCd>
            <urn1:ChecksumAugmentationNum>[CheckSum]</urn1:ChecksumAugmentationNum>
            <urn1:AttachmentByteSizeNum>[Bytes]</urn1:AttachmentByteSizeNum>
            <urn:DocumentSystemFileNm>1094C_Request_[TCC]_20181226T161942345Z.xml</urn:DocumentSystemFileNm>
        </urn:ACATransmitterManifestReqDtl>
        <urn2:ACABusinessHeader wsu:Id="id-E71242CFDF04487D9ECA0AC2E1544E90" 
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <urn:UniqueTransmissionId>6de74234-d0fd-45b2-ad45-b408fd137201:SYS12:[TCC]::T</urn:UniqueTransmissionId>
            <urn1:Timestamp>2018-12-26T16:19:42Z</urn1:Timestamp>
        </urn2:ACABusinessHeader>
        <urn3:ACASecurityHeader>
            <urn2:UserId>1#######</urn2:UserId>
        </urn3:ACASecurityHeader>
        <wsa:Action>BulkRequestTransmitter</wsa:Action>
    </soapenv:Header>
    <soapenv:Body>
        <urn4:ACABulkRequestTransmitter version="1.0">
            <urn1:BulkExchangeFile>
                <inc:Include href="cid:1094C_Request_[TCC]_20181226T161942345Z.xml" 
                    xmlns:inc="http://www.w3.org/2004/08/xop/include" />
            </urn1:BulkExchangeFile>
        </urn4:ACABulkRequestTransmitter>
    </soapenv:Body>
</soapenv:Envelope>
----023e657d-66f5-4e92-8e6e-c223338c205a
Content-Type: application/xml
Content-Transfer-Encoding: 7bit
Content-Id: <1094C_Request_[TCC]_20181226T161942345Z.xml>
Content-Disposition: attachment; filename="1094C_Request_[TCC]_20181226T161942345Z.xml"

<?xml version="1.0" encoding="utf-8"?>
    <n1:Form109495CTransmittalUpstream xmlns="urn:us:gov:treasury:irs:ext:aca:air:ty18" 
        xmlns:irs="urn:us:gov:treasury:irs:common" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:p3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xsi:schemaLocation="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage IRS-Form1094-1095CTransmitterUpstreamMessage.xsd" 
        xmlns:n1="urn:us:gov:treasury:irs:msg:form1094-1095Ctransmitterupstreammessage">
        [Removed for Space]
    </n1:Form109495CTransmittalUpstream>
----023e657d-66f5-4e92-8e6e-c223338c205a--

更新:我添加了安全性 Header 并且已经解决了这个特定问题,现在正在解决 WS-Security 错误。我还用更改的内容更新了我的信封。

只是把它扔到风中(更多评论但太长了),但看起来你从他们的例子中遗漏了这些元素:

<urn4:ACASecurityHeader xmlns:urn4="urn:us:gov:treasury:irs:msg:acasecurityheader" />
<oas:Security xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401- wss-wssecurity-secext-1.0.xsd" /> 

您正在为 urn3 使用此前缀,据我所知,任何元素都没有引用它。不确定它是否有任何区别,但上面的元素确实在给你错误的部分之前。如果您觉得这听起来毫无意义,请随意忽略。

我想补充一点,这是我几年前通过开发此过程学到的一件事:您发送的请求,无论是状态请求还是提交请求,都需要与他们的示例相同。

我用来完成此操作的方法是创建单独的 XML 模板文档(一个用于提交,一个用于状态),其中包含每个请求所需的全部 XML。

在高层次上,我的应用程序通过用适当的数据填充它们来使用 WSDL 对象,然后我用对象中的值替换模板中的 XML 元素,签署 XML文档,附上表单数据(用于提交),然后发送请求。

查看您 post 的内容并将其与我之前传输的内容进行比较,我发现了一些不同之处:

  • 在你的信封定义中,你有一个属性xmlns:oasl,我没有这个
  • 在你的 InclusiveNamespaces 元素中,我有 PrefixList="wsse wsa soapenv urn urn1 urn2 urn3"。有人告诉我必须有这个字面值。
  • 你的 DigestMethod 是 sha256,而我的是 sha1。我知道两者之间存在差异,但这可能会给您带来一些问题?
  • 我有一个包含 urn1:UserId 元素的 urn3:ACASecurityHeader 元素,我认为你已经解决了(它只是没有在你原来的 post 中更新)

这是我当前尝试发送的信封,它导致返回 TPE1122 WS Security Header 错误。

以下信封XML为TY2018传输的工作信封。信息已被编辑。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:urn="urn:us:gov:treasury:irs:ext:aca:air:ty18" 
                  xmlns:urn1="urn:us:gov:treasury:irs:common" 
                  xmlns:urn2="urn:us:gov:treasury:irs:msg:acabusinessheader" 
                  xmlns:urn3="urn:us:gov:treasury:irs:msg:acasecurityheader" 
                  xmlns:urn4="urn:us:gov:treasury:irs:msg:irsacabulkrequesttransmitter">
    <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 Id="SIG-E9efb6eb0a76b4277a5cf8dc3930a868d" xmlns="http://www.w3.org/2000/09/xmldsig#">
                <SignedInfo>
                    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments" />
                    <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
                    <Reference URI="#TS-E057d0d55370e45a8bc8a42f995a89aa3">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsse wsa soapenv urn urn1 urn2 urn3" 
                                                     xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[TIMESTAMP DIGEST VALUE]</DigestValue>
                    </Reference>
                    <Reference URI="#id-Ed6c3f891454e4eeaa73aeacaf21b6857">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsa soapenv urn1 urn2 urn3" 
                                                     xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[ACA BUSINESS HEADER DIGEST VALUE]</DigestValue>
                    </Reference>
                    <Reference URI="#id-Eda32be00e9954326a8dbbd30a86a975e">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                                <InclusiveNamespaces PrefixList="wsa soapenv urn urn1 urn3" 
                                                     xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" />
                            </Transform>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
                        <DigestValue>[ACA TRANSMITTER MANIFEST DIGEST VALUE]</DigestValue>
                    </Reference>
                </SignedInfo>
                <SignatureValue>[SIGNATURE VALUE]</SignatureValue>
                <KeyInfo Id="KI-E70e6fef54fa44300bf8f732831579e03">
                    <wsse:SecurityTokenReference wsu:Id="STR-Ee23913563c7843c7917a3c63f9830d6f">
                        <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">[CERTIFICATE KEY IDENTIFIER]</wsse:KeyIdentifier>
                    </wsse:SecurityTokenReference>
                </KeyInfo>
            </Signature>
            <wsu:Timestamp wsu:Id="TS-E057d0d55370e45a8bc8a42f995a89aa3">
                <wsu:Created>2019-01-07T16:32:54.353Z</wsu:Created>
                <wsu:Expires>2019-01-07T16:42:54.353Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
        <urn:ACATransmitterManifestReqDtl wsu:Id="id-Eda32be00e9954326a8dbbd30a86a975e" 
                                          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-Ed6c3f891454e4eeaa73aeacaf21b6857" 
                                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <urn:UniqueTransmissionId>e8d5fbcf-564d-4e31-8b48-ecc2fffe8fc0:SYS12:[TCC]::T</urn:UniqueTransmissionId>
            <urn1:Timestamp>2019-01-07T08:32:54Z</urn1:Timestamp>
        </urn2:ACABusinessHeader>
        <urn3:ACASecurityHeader>
            <urn1:UserId>[USER ID]</urn1:UserId>
        </urn3:ACASecurityHeader>
        <wsa:Action>BulkRequestTransmitterService</wsa:Action>
    </soapenv:Header>
    <soapenv:Body>
        <urn4:ACABulkRequestTransmitter version="1.0">
            <urn1:BulkExchangeFile>
                <xop:Include href="cid:1094C_Request_[TCC]_20190107T163254215Z.xml" xmlns:xop="http://www.w3.org/2004/08/xop/include" />
            </urn1:BulkExchangeFile>
        </urn4:ACABulkRequestTransmitter>
    </soapenv:Body>
</soapenv:Envelope>