Federico Mariani created CAMEL-27074:
----------------------------------------

             Summary: camel-cxf - the POJO producer given the request wrapper 
object of an operation fails without naming the wrapped option
                 Key: CAMEL-27074
                 URL: https://issues.apache.org/jira/browse/CAMEL-27074
             Project: Camel
          Issue Type: Improvement
          Components: camel-cxf
            Reporter: Federico Mariani


By default ({{wrapped=false}}) the cxf producer in POJO mode invokes a 
document-literal wrapped operation with its parameters. When the message body 
is the request wrapper object of the operation (such as the {{GreetMe}} class 
generated for the {{greetMe}} element), the call fails, and the error does not 
say that {{wrapped=true}} sends the wrapper object:
* for an operation with one parameter, CXF fails in 
{{WrapperClassOutInterceptor}} with {{class ...GreetMe cannot be cast to class 
java.lang.String}};
* for an operation with two parameters, the producer fails with {{Get the wrong 
parameter size to invoke the out service, Expect size 2, Parameter size 1}}, 
which names neither the operation nor its parameter types.

{code:java}
GreetMe request = new GreetMe();
request.setRequestType("Willem");
template.requestBody("cxf://http://localhost:9000/SoapPort?serviceClass=org.apache.hello_world_soap_http.Greeter";
        + "&defaultOperationName=greetMe", request); // Fault: GreetMe cannot 
be cast to class java.lang.String
{code}

With {{&wrapped=true}} the wrapper object is sent, but the reply is still 
unwrapped: a {{MessageContentsList}} that holds the return value ({{"Hello 
Willem"}}), not a {{GreetMeResponse}}. The description of the {{wrapped}} 
option does not say so.

Expected:
* a body that is the request wrapper object, while {{wrapped}} is false, fails 
with an {{IllegalArgumentException}} that names the operation, its parameter 
types and the {{wrapped}} option;
* the "wrong parameter size" messages name the operation and its parameter 
types;
* the {{wrapped}} option and the POJO section of the component page say that 
only the request is in wrapped form.

No change for calls that work today.

_Claude Code on behalf of Federico Mariani_



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

Reply via email to