1

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?

Stijn Hooft
  • 170
  • 1
  • 12

1 Answers1

0

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"?

TacheDeChoco
  • 3,683
  • 1
  • 14
  • 17
  • I'm not sure if that is true in this case. The client, which is a Wildlfy 8 instance, makes a request to a Soap webservice. This request message is heavier than 4 kb, which makes Apache CXF decide to send this in chunks. The server does not tell that this request should be in chunks. However, you're right that client cannot control whether the server should respond in chunks. That's up to the server. My problem lies in the given that the server does not seem to support an incoming message that is cut in chunks. – Stijn Hooft Aug 24 '18 at 13:52
  • 1
    Sorry, I did not catch that it was the soap message of the request (and not of the response) that was large. In that case, you are right, the client is allowed to chunk its message. Now to solve your problem, knowing that the JAX-WS implementation is CXF in Wildfly (at least since v8), I suggest you 1) to modify the CXF http conduit programatically or 2) override default of "cxf.client.allowChunking" and "cxf.client.chunkingThreshold" system properties See more at: https://docs.jboss.org/author/display/JBWS/Apache+CXF+integration#ApacheCXFintegration-HTTPConduitconfiguration – TacheDeChoco Aug 24 '18 at 19:52