在Wildfly 8中为JAX-WS客户端禁用分块传输编码 [英] Disable chunked transfer-encoding for JAX-WS Client in Wildfly 8

查看:72
本文介绍了在Wildfly 8中为JAX-WS客户端禁用分块传输编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Wildfly 8 上使用JAX-WS编写SOAP客户端.

I'm writing a SOAP client using JAX-WS on Wildfly 8.

向我的服务器发送小消息时,客户端可以正常工作.当邮件太大时,将添加标题传输编码:分块" ,服务器将停止接受邮件.

When sending small messages to my server, the client works properly. When the message gets too large, a header "Transfer-Encoding: chunked" gets added and the server stops accepting the messages.

由于我无法控制服务器部分,因此我正在寻找一种方法来告诉Wildfly停止对大型邮件进行分块.

Since I have no control over the server-part, I'm looking for a way to tell Wildfly to stop chunking large messages.

我在这里找到了针对WebSphere的解决方案:

I've found a solution for WebSphere here: Disable chunked transfer-encoding for JAX-WS Client in WebSphere Application Server 8.5

我已经配置了处理程序.我已验证此处理程序在每个传出请求中均被调用.看起来像这样:

I've configured a Handler. I've verified that this handler is called with each outgoing request. It looks like this:

public boolean handleMessage(SOAPMessageContext smc) {
  ctx.put(*HTTPConstants.CHUNKED*, "false");
  return true;
}

由于我使用的是Wildfly,而不是WebSphere,因此我的类路径上没有HTTPConstants.CHUNKED.有人知道我可以用来告诉Wildlfy停止对邮件进行分块吗?甚至可以通过使用处理程序来做到这一点?

Since I'm using Wildfly, and not WebSphere, I don't have HTTPConstants.CHUNKED on my classpath. Does anyone know what I could use to tell Wildlfy to stop chunking messages? Is this even possible by using a handler?

推荐答案

据我所知,客户端无权使用或不使用HTTP分块.客户端应该接受两者,并且最终决定是在服务器端上完成的.

As far as I know, the client is not entitled to use or not use HTTP chunking. The client is supposed to accept both, and the final decision is made on the server-side.

重要的是要了解分块不是一种格式,而是一种传输编码.让服务器选择传输大数据的最佳方式听起来很自然(压缩是一种可能的选择,分块是另一种选择)...

It's important to understand the the chunking is not a format but a transfer encoding. It sounds quite natural to let the server choose the best way to transfer large data (zipping is a possible option, chunking is another one)...

请参见> HTTP 1.1-可以客户请求转账不被分块"吗?

这篇关于在Wildfly 8中为JAX-WS客户端禁用分块传输编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆