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

Posted

技术标签:

【中文标题】MTOM - [row,col unknown-source] 的序言中出现意外的 EOF:[1,0]【英文标题】:MTOM - Unexpected EOF in prolog at [row,col unknown-source]: [1,0]MTOM - [row,col unknown-source] 的序言中出现意外的 EOF:[1,0] 【发布时间】:2021-07-17 16:29:11 【问题描述】:

我正在尝试通过邮递员发送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

我正在使用的标题:

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--'

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

【问题讨论】:

您确定实际使用了自定义内容类型标头吗?我看到使用了邮递员的“文本”正文类型,这意味着它可以用 text/plain 覆盖您的自定义... 嗨@GPI,在这种情况下应该使用什么?你能帮我解决这个问题吗 为了帮助调试,您能否将邮递员的“code sn-p”选项卡(发送按钮右侧)显示的内容添加到您的问题中,这将拼写出请求,因为它是在另一个中发送的格式,例如cURL. 添加邮递员生成的 cURL 命令@GPI 谢谢。乍一看,一切看起来都还不错。缺少的一件事(但我不知道它是否在规范上很重要)是内容类型的 start 属性,它应该是内容 id 或 XML 部分,所以 "&lt;rootpart*7661941e-06d9-4961-af10-db612c7ffcc4@example.jaxws.sun.com&gt;" 在你的情况下。您还确定服务器端点接受 XOP+MTOM 吗? 【参考方案1】:

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

更准确地说,您需要在每个部分的标题与其正文之间跳过一行(空白行),例如更改 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>

在多部分内容中,必须用空行将标题与正文分开。

【讨论】:

以上是关于MTOM - [row,col unknown-source] 的序言中出现意外的 EOF:[1,0]的主要内容,如果未能解决你的问题,请参考以下文章

尝试MarkDown语法

Python 发送 mtom 消息

Vue e-row、el-col高度一致且内容居中

从 pentaho 中的 ROWS 获取最大值

如何与“row_number() over (partition by [Col] order by [Col])”相反

CSS 中 textarea 的 rows 和 cols 属性