问题
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.
Since I have no control over the server-part, I'm looking for a way to tell Wildfly to stop chunking large messages.
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;
}
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?
回答1:
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)...
See HTTP 1.1 - Can a client request that transfers not be "chunked"?
来源:https://stackoverflow.com/questions/52000026/disable-chunked-transfer-encoding-for-jax-ws-client-in-wildfly-8