MTOM - [row,col {unknown-source}] 序言中的意外 EOF:[1,0]

MTOM - Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0]

我正在尝试通过邮递员发送 multipart/related 请求。但我收到错误:

<soap:Reason>
    <soap:Text xml:lang="en">Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]</soap:Text>
</soap:Reason>

端点: POST https://sdummy.test.net/enterprise/soap?ServiceName=IntegrationManagementService

Headers 我正在使用:

Content-Type:multipart/related; start="<rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>"; type="application/xop+xml"; boundary="uuid:7661941e-06d9-4961-af10-db612c7ffcc4"; start-info="text/xml"
Soapaction:http://www.taleo.com/ws/integration/toolkit/2011/05/management/IntegrationManagementService#submitLargeDocument
Accept:text/xml, multipart/related, text/html, image/gif, image/jpeg, *;q=.2, */*; q=.2
User-Agent:Oracle JAX-WS 2.1.5
Transfer-Encoding:chunked
Host:sdummy.test.net

有效负载:

--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/03/addressing" xmlns:tns="http://www.taleo.com/ws/integration/toolkit/2011/05/management">
    <SOAP-ENV:Header>
        <wsa:MessageID>ps_sd_7701</wsa:MessageID>
        <wsa:Action>http://www.taleo.com/ws/integration/toolkit/2005/07/action/import</wsa:Action>
        <wsa:ReplyTo>
            <wsa:Address>http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue</wsa:Address>
        </wsa:ReplyTo>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <wsa:submitLargeDocument>
            <wsa:Document>
                <Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:51349b7a-562a-4e98-ab8c-736cfecb03eb@example.jaxws.sun.com"/>
            </wsa:Document>
        </wsa:submitLargeDocument>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id:<51349b7a-562a-4e98-ab8c-736cfecb03eb@example.jaxws.sun.com>
Content-Type: text/plain; charset=ISO-8859-1 
Content-Transfer-Encoding: binary
    <ImportEntities>
        <Candidate>
            <EmailAddress>test11@mailinator.com</EmailAddress>
        </Candidate>
    </ImportEntities>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4--

Postman 生成的 cURL 命令:

curl --location --request POST 'https://stghilton.taleo.net/enterprise/soap?ServiceName=IntegrationManagementService' \
--header 'Content-Type: multipart/related; start="<rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>"; type="application/xop+xml"; boundary="uuid:7661941e-06d9-4961-af10-db612c7ffcc4"; start-info="text/xml"' \
--header 'Soapaction: http://www.taleo.com/ws/integration/toolkit/2011/05/management/IntegrationManagementService#submitLargeDocument' \
--header 'Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *;q=.2, */*; q=.2' \
--header 'User-Agent: Oracle JAX-WS 2.1.5' \
--header 'Transfer-Encoding: chunked' \
--header 'Host: stghilton.taleo.net' \
--header 'Authorization: Basic UGhlbm9tOj80K2pTSlAz' \
--data-raw '--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/03/addressing" xmlns:tns="http://www.taleo.com/ws/integration/toolkit/2011/05/management">
    <SOAP-ENV:Header>
        <wsa:MessageID>ps_sd_7701</wsa:MessageID>
        <wsa:Action>http://www.taleo.com/ws/integration/toolkit/2005/07/action/import</wsa:Action>
        <wsa:ReplyTo>
            <wsa:Address>http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue</wsa:Address>
        </wsa:ReplyTo>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <wsa:submitLargeDocument>
            <wsa:Document>
                <Include xmlns="http://www.w3.org/2004/08/xop/include" href="cid:51349b7a-562a-4e98-ab8c-736cfecb03eb@example.jaxws.sun.com"/>
            </wsa:Document>
        </wsa:submitLargeDocument>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4
Content-Id:<51349b7a-562a-4e98-ab8c-736cfecb03eb@example.jaxws.sun.com>
Content-Type: text/xml; charset=ISO-8859-1 
Content-Transfer-Encoding: binary
    <ImportEntities>
        <Candidate>
            <EmailAddress>test11@mailinator.com</EmailAddress>
        </Candidate>
    </ImportEntities>
--uuid:7661941e-06d9-4961-af10-db612c7ffcc4--'

有人可以帮我解决这个问题吗?

从纯技术的角度来看,我能看到的唯一错误是您对多部分结构的处理。

更准确地说,您需要在每个部分的 header 和它们的 body 之间跳过一行(空行),例如更改 3 行:

Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>

至 4 行:

Content-Id: <rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary

<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?>

在每个部分,例如也在这里:

Content-Transfer-Encoding: binary
<ImportEntities>

Content-Transfer-Encoding: binary

<ImportEntities>

在多部分内容中必须用空行将 header 与 body 分开。