Claus Ibsen created CAMEL-26142:
-----------------------------------

             Summary: camel-spring-ws - a route ending with a null body sends 
the request payload back, and a reply that does not convert to Source gives an 
empty SOAP body
                 Key: CAMEL-26142
                 URL: https://issues.apache.org/jira/browse/CAMEL-26142
             Project: Camel
          Issue Type: Bug
          Components: camel-spring-ws
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of spring-ws (CAMEL-24961, PR #28395).

h4. 1. A route ending with a null body sends the request payload back

{{SpringWebserviceMessage.createBody}} (main 2a465aa4814c, line 38) rebuilds 
the body from the request's {{getPayloadSource()}} whenever the body is null, 
so a route that ends with {{setBody(null)}} (or {{setBody(constant(null))}}) 
replies with the request payload instead of an empty response. Checked on 
4.24.0-SNAPSHOT with spring-ws and an in-memory message sender.

Proposed: only use the request payload until the body has been set (track an 
explicit null body), so a null reply gives an empty SOAP body.

h4. 2. A reply that does not convert to Source gives an empty SOAP body

{{SpringWebserviceConsumer}} (line 86) uses the non-mandatory 
{{getBody(Source.class)}}; for a Map or a raw {{ByteArrayInputStream}} it is 
null and the reply is an empty SOAP body, with no fault and no log. Checked on 
4.24.0-SNAPSHOT with spring-ws and an in-memory message sender.

Proposed: use {{getMandatoryBody(Source.class)}} for a non-null reply so it 
ends as a fault with the conversion error.

h4. 3. The producer rejects a File body and a raw InputStream without stream 
caching

{{SpringWebserviceProducer}} (line 80) calls 
{{getMandatoryBody(Source.class)}}: there is no File to Source converter, and a 
raw InputStream does not convert when stream caching is off, so both fail with 
{{InvalidPayloadException}} although they hold XML. Checked on 4.24.0-SNAPSHOT 
with spring-ws and an in-memory message sender.

Proposed: convert a File or an InputStream to a {{StreamSource}} before the 
mandatory conversion.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to