Croway commented on code in PR #30232:
URL: https://github.com/apache/camel/pull/30232#discussion_r4598482827


##########
components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfProducer.java:
##########
@@ -439,16 +462,46 @@ private BindingOperationInfo 
getBindingOperationInfo(Exchange ex) {
 
             LOG.trace("Operation qname = {}", qname);
 
-            answer = 
client.getEndpoint().getEndpointInfo().getBinding().getOperation(qname);
+            answer = binding.getOperation(qname);
             if (answer == null) {
                 throw new IllegalArgumentException(
                         "Can't find the BindingOperationInfo with operation 
name " + qname
-                                                   + ". Please check the 
message headers of operationName and operationNamespace.");
+                                                   + ". Please check the " + 
CxfConstants.OPERATION_NAME + " and "
+                                                   + 
CxfConstants.OPERATION_NAMESPACE
+                                                   + " headers, or the 
defaultOperationName and defaultOperationNamespace"
+                                                   + " options. The operations 
of the service are "
+                                                   + operationNames(binding));
             }
         }
         return answer;
     }
 
+    private void warnOnFormerOperationHeaders(Exchange ex) {
+        if (formerOperationHeadersWarned) {
+            return;
+        }
+        String former = null;
+        if (ex.getIn().getHeader(CxfConstants.OPERATION_NAME) == null
+                && ex.getIn().getHeader(FORMER_OPERATION_NAME) != null) {
+            former = FORMER_OPERATION_NAME;
+        } else if (ex.getIn().getHeader(CxfConstants.OPERATION_NAMESPACE) == 
null
+                && ex.getIn().getHeader(FORMER_OPERATION_NAMESPACE) != null) {
+            former = FORMER_OPERATION_NAMESPACE;
+        }
+        if (former != null) {
+            formerOperationHeadersWarned = true;
+            LOG.warn("The producer of endpoint {} does not read the {} header: 
the operation is selected by the {} and {}"
+                     + " headers (CxfConstants.OPERATION_NAME and 
CxfConstants.OPERATION_NAMESPACE), which replaced the {}"
+                     + " and {} headers. This is logged once.",
+                    endpoint, former, CxfConstants.OPERATION_NAME, 
CxfConstants.OPERATION_NAMESPACE, FORMER_OPERATION_NAME,
+                    FORMER_OPERATION_NAMESPACE);
+        }
+    }

Review Comment:
   I kept the single WARN, after checking both cases. With both former headers 
set, the WARN says the producer does not read `operationName`, and that 
`CamelCxfOperationName` and `CamelCxfOperationNamespace` replaced 
`operationName` and `operationNamespace`, so it names both.
   
   The flag is per producer, and a route restart, `reloadAllRoutes()` or a 
route update creates a new producer: after fixing only `operationName`, the new 
producer logs `does not read the operationNamespace header`. The namespace goes 
unreported only when one producer sees both mistakes on different exchanges in 
the same run. The former namespace is not read anyway: the producer uses 
`defaultOperationNamespace` or the service namespace, and fails with the error 
that names `CamelCxfOperationNamespace` when that is wrong.
   
   _Claude Code on behalf of Federico Mariani_
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to