[ 
https://issues.apache.org/jira/browse/CAMEL-27062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Mariani resolved CAMEL-27062.
--------------------------------------
    Resolution: Fixed

> camel-cxf, camel-cxfrs - the producers ignore the former operationName header 
> without a hint, and send it as an HTTP header
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27062
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27062
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxf, camel-cxfrs
>            Reporter: Federico Mariani
>            Assignee: Federico Mariani
>            Priority: Minor
>             Fix For: 4.18.6, 4.22.3, 4.24.0
>
>
> Since CAMEL-23526 the cxf and cxfrs producers select the operation from the 
> {{CamelCxfOperationName}} header (and, for cxf, 
> {{CamelCxfOperationNamespace}}). A route that still sets the former 
> {{operationName}} header gets no hint that the header is not read.
> *cxf*: the producer logs at DEBUG only and invokes the first operation that 
> CXF returns for the service. CXF keeps the operations in a hash map, so this 
> is not the first operation of the WSDL (for the {{Greeter}} test service it 
> is {{testDocLitFault}}). The {{operationName}} header is also sent to the 
> service as an HTTP header, because {{CxfHeaderFilterStrategy}} now filters 
> only the new names.
> {code:java}
> from("direct:start")
>     .setHeader("operationName", constant("greetMe")) // former name
>     .setBody(constant(List.of("Willem")))
>     
> .to("cxf://http://localhost:9000/SoapPort?serviceClass=org.apache.hello_world_soap_http.Greeter";);
> // invokes testDocLitFault, and the service receives an operationName HTTP 
> header
> {code}
> The same happens, without the former header, for any service with more than 
> one operation when neither {{CamelCxfOperationName}} nor 
> {{defaultOperationName}} is set.
> When the operation is not found, the error still names the former headers and 
> does not list the operations of the service:
> {noformat}
> Can't find the BindingOperationInfo with operation name 
> {http://wrong/ns}greetMe. Please check the message headers of operationName 
> and operationNamespace.
> {noformat}
> *cxfrs*: with the proxy-based client API ({{httpClientAPI=false}}) the 
> producer finds the method of the resource class from 
> {{CamelCxfOperationName}} only. Without it, the exchange fails with an error 
> that names no header:
> {noformat}
> java.lang.NoSuchMethodException: Cannot find method with name: null having 
> parameters assignable from: [class java.lang.String]
> {noformat}
> {{CxfRsHeaderFilterStrategy}} also filters only the new name, so an 
> {{operationName}} header is sent to the service as an HTTP header, with both 
> client APIs.
> {code:java}
> from("direct:start")
>     .setHeader("operationName", constant("getCustomer")) // former name
>     .setBody(constant("123"))
>     
> .to("cxfrs://http://localhost:9000/rest?httpClientAPI=false&resourceClasses=org.example.CustomerService";);
> // fails with "Cannot find method with name: null", and the operationName 
> header is sent with the requests that succeed
> {code}
> Expected:
> * cxf: a WARN, logged once per producer, when {{operationName}} or 
> {{operationNamespace}} is set without its replacement, naming the new headers;
> * cxf: a WARN, logged once per producer, when no header and no option selects 
> the operation of a service with more than one operation;
> * cxf: the error names {{CamelCxfOperationName}}, 
> {{CamelCxfOperationNamespace}} and the 
> {{defaultOperationName}}/{{defaultOperationNamespace}} options, and lists the 
> operations of the service;
> * cxfrs: the {{NoSuchMethodException}} names {{CamelCxfOperationName}} and, 
> when {{operationName}} is set, says that it is not read. Every such exchange 
> fails, so the error is the hint, and no WARN is needed;
> * {{CxfHeaderFilterStrategy}} and {{CxfRsHeaderFilterStrategy}} filter the 
> former names again, as they did before the rename.
> The producers keep ignoring the former headers: the rename is not reverted.
> _Claude Code on behalf of Federico Mariani_



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

Reply via email to