所以你不会像我一样陷入困境,挠头思考为什么会发生这种情况,这是问题的解释和解决方案。
出现这个问题是因为默认情况下 apach cxf 使用“分块”,一旦达到定义的阈值,它基本上会向端点发送小块数据。这会导致 SOAP 消息在不完整的情况下被发送,从而导致“403”(假设服务器不支持“分块”)!解决方案是禁用“分块”,通过将 spring-config.xml 更改为:
<http-conf:conduit name="*.http-conduit">
<http-conf:client Connection="Keep-Alive"
MaxRetransmits="1"
AllowChunking="false" />
Run Code Online (Sandbox Code Playgroud)
附加信息:
在 org.apache.cxf.transport.http.HTTPConduit 上,对于“准备”方法,有一点可以解释所有内容:
// DELETE does not work and empty PUTs cause misleading exceptions
// if chunking is enabled
// TODO : ensure chunking can be enabled for non-empty PUTs - if requested
if (csPolicy.isAllowChunking()
&& isChunkingSupported(message, httpRequestMethod)) {
//TODO: The chunking mode be configured or at least some
// documented client constant.
//use -1 and allow the URL connection to pick a default value
isChunking = true;
chunkThreshold = csPolicy.getChunkingThreshold();
}
cookies.writeToMessageHeaders(message);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1960 次 |
| 最近记录: |