Invoking CXF SOAP service with a chunked response gives null body

61 Views Asked by At

I've implemented a dynamic CxfEndpoint that i'm invoking through a FluentProducerTemplate. The service is invoked correctly, and it returns a what it appears to be a chunked response, even if without the Content-Encoding header: a first empty payload, with just the headers, and a second with the full response. Camel seems to close the transaction after the first chunk, giving back an empty body.

Is there any way to force it to await the second chunk, based on the Content-Length header?

Here is the FluentProducer:

InputStream inputStream = camelContext.createFluentProducerTemplate()
                   .withHeader("SOAPAction", soapActionPrefix + soapActionSeparator + operationName)
                   .withHeader("Content-Type", "text/xml; charset=UTF-8")
                   .withBody(exchange.getMessage().getBody())
                   .to("cxf://bean://" + ServiceEndpointUtil.getEndpointName(serviceEndpoint))
                   .request(InputStream.class);

Here the "chunked" payloads:

----------------------------
ID: 50537
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {Content-Length=[860], Content-Type=[text/xml; charset=utf-8], Date=[Thu, 05 Oct 2023 06:58:04 GMT], Server=[Microsoft-IIS/10.0], X-Powered-By=[ASP.NET]}
----------------------------

----------------------------
ID: 50537
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {Content-Length=[860], Content-Type=[text/xml; charset=utf-8], Date=[Thu, 05 Oct 2023 06:58:04 GMT], Server=[Microsoft-IIS/10.0], X-Powered-By=[ASP.NET]}
Payload: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <ActivityId xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" CorrelationId="c24eb538-4dfe-4dc1-94aa-5ab7f19cb248">00000000-0000-0000-0000-000000000000</ActivityId>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    
          ...  ...  ...

  </s:Body>
</s:Envelope>

--------------------------------------
0

There are 0 best solutions below