You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by titaniumlou <ti...@gmail.com> on 2015/10/08 21:27:08 UTC

CXF IOUtils truncating POST request content?

Hi, I'm using CXF as the transport for a SOAP client and am using the
AsyncHTTpConduit to be able to use NTLM authentication but I'm seeing POST
requests after the first attempted one only sending 256k of data.

Additionally I see there are 2 temp files created for the request. One file
contains the entire contents of the POST request but the 2nd file only
contains the first 256k of the request (and is missing the closing soap
envelope tag, etc)

I believe the 256k amount being written to the 2nd file is a result of
IOUtils.copy capping the buffer at 262144 when attempting to write the
cached request content to the 2nd file.

I've tried setting org.apache.cxf.io.CachedOutputStream.Threshold to
something large and see the temp files don't get created, but then the
requests fail for other reasons. Maybe this implicates some concurrency
issues in HTTPAsyncClient or CXF's use of it?



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-IOUtils-truncating-POST-request-content-tp5761619.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF IOUtils truncating POST request content?

Posted by titaniumlou <ti...@gmail.com>.
logged a bug here https://issues.apache.org/jira/browse/CXF-6651



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-IOUtils-truncating-POST-request-content-tp5761619p5762105.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF IOUtils truncating POST request content?

Posted by titaniumlou <ti...@gmail.com>.
I've done some further testing and found that when the target IIS server only
uses Basic Authentication I am able to POST the same data that fails to
successfully POST when using NTLM authentication.

Additionally, capturing HTTP traffic on the target IIS server shows "HTTP:
401 Unauthorized" responses being sent to the client well before the POST
data has been fully sent. Perhaps this is causing the issue or contributing?

Curious if anyone else has run into these issues, and if I should open a bug
against CXF to have this investigated further, or if I'm alone in
encountering this problem.

If any other data is needed just let me know.



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-IOUtils-truncating-POST-request-content-tp5761619p5762018.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: CXF IOUtils truncating POST request content?

Posted by titaniumlou <ti...@gmail.com>.
FWIW here's my code configuring the bus & conduit:

        ExchangeWebService exchangeWebService = new ExchangeWebService();
        ExchangeServicePortType exchangeConn =
exchangeWebService.getExchangeWebPort();

       
((BindingProvider)exchangeConn).getRequestContext().put(AsyncHTTPConduit.USE_ASYNC,
Boolean.TRUE);
       
((BindingProvider)exchangeConn).getRequestContext().put(Credentials.class.getName(),
                new NTCredentials(finalUsername, password, null,
finalDomain));
        ((BindingProvider)
exchangeConn).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
wsdlURL);

        Client client = ClientProxy.getClient(exchangeConn);

        Bus bus = client.getBus();
        bus.setExtension(new AsyncHTTPConduitFactory(bus) {
            @Override
            protected void adaptClientBuilder(HttpAsyncClientBuilder
httpAsyncClientBuilder) {
                httpAsyncClientBuilder.setTargetAuthenticationStrategy(new
TargetAuthenticationStrategy() {
                    @Override
                    protected boolean isCachable(AuthScheme authScheme) {
                        return false;
                    }
                });
            }

            @Override
            public HTTPConduit createConduit(HTTPTransportFactory f, Bus
bus, EndpointInfo localInfo, EndpointReferenceType target) throws
IOException {
                HTTPConduit newConduit = super.createConduit(f, bus,
localInfo, target);
                HTTPClientPolicy clientPolicy = newConduit.getClient();
                if (clientPolicy == null) {
                    clientPolicy = new HTTPClientPolicy();
                }
                clientPolicy.setAutoRedirect(true);
                clientPolicy.setAllowChunking(false);
               
clientPolicy.setConnectionTimeout(connTimeout.orElse(EXCHANGE_CONNECT_TIMEOUT));
               
clientPolicy.setReceiveTimeout(reqTimeout.orElse(EXCHANGE_REQUEST_TIMEOUT));
                newConduit.setClient(clientPolicy);
                return newConduit;
            }
        }, HTTPConduitFactory.class);

And here's a listing of CXF's temp directory:
        448155 Oct 11 08:59 cos4445977419887489515tmp
        262144 Oct 11 08:59 cos5255388977599556617tmp

The POST eventually fails due to a timeout since the server is still waiting
for the entire POST contents but all the client sends on the final request
is the 256k contained in the 2nd file listed above.

And if it matters at all this is accessing a Microsoft Exchange Web Services
endpoint



--
View this message in context: http://cxf.547215.n5.nabble.com/CXF-IOUtils-truncating-POST-request-content-tp5761619p5761718.html
Sent from the cxf-user mailing list archive at Nabble.com.