Hi, long time again!
Spent a few days with this on and off and finally solved the problem. So it is worth posting! The source of the problem is not universal, probably. But the solution would be useful for many.
For some strange reason, our CXF client fails to talk to a Web server when the payload is more than 40KB. It works fine when the attachment to SOAP is less than that. This is really absurd. Using Wireshark, it was determined that the communication failed at the TCP level. Because it is hard to change the receiver side, and it is relatively easier to change on the client side, we decided to alter the http transport layer that came with CXF.
To make things more complicated, our client uses Karaf as the OSGi impl. I first followed the instruction of adding META-INF\services\javax.xml.ws.spi.Provider with the contents com.sun.xml.internal.ws.spi.ProviderImpl. But Karaf didn’t care that at all. Actually, Karaf throws a weird exception:
javax.xml.ws.spi.FactoryFinder$ConfigurationError: Provider org.apache.cxf.jaxws.spi.ProviderImpl not found
After many trials, the only thing that worked was to use dynamic System property setting at run time before the Webservice client call.
String existingSpi = System.getProperty(“javax.xml.ws.spi.Provider”);
// —JAX-WS code calls Webservices —
This successfully avoids CXF impl. to the default JAX-WS impl for the HTTP SPI provider implementation.
Note that there is really nothing wrong with CXF impl per se, but under the Karaf environment runtime, the above code allows us to alter the provider to make our client work with the server.