Just FYI, I just committed a fix for this.   Should be in tomorrows snapshots.

I'm kind of productive when the RedSox are losing really badly and then go 
into rain delay.  :-(

Dan



On Mon September 28 2009 7:14:00 pm Arik Gorelik wrote:
> Hello,
> 
> I am a developer using CXF 2.2.3. I am currently running into an issue when
> trying to call a NO-ARG method getFoo()
> while using implicit headers defined ONLY at the wsdl:binding section.
> Each header has a SEPARATE wsdl:message defined and headers elements are
>  NOT part of the getFooRequest wsdl:message.
> The generated code looks correct (using wsdl2java); however, invoking the
> method results in the error message in the following soap fault message:
> 
>          <faultstring>wrong number of arguments while invoking public
> com.test.services.v29.FooResponse
> com.test.services.v29.TestServiceImpl.getFoo() throws
> com.test.services.v29.TestException with params [null].</faultstring>
> 
> Here is the stack trace:
> 
> WARNING: Application has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: wrong number of arguments while invoking
> public com.test.services.v29.FooResponse
> com.test.services.v29.TestServiceImpl.getFoo() throws
> com.test.services.v29.TestException with params [null].
> at
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.
> java:152)
> 
> at
> org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMe
> thodInvoker.java:83)
> 
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 126)
> 
> at
> org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:55)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 68)
> 
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerIn
> terceptor.java:58)
> 
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.ja
> va:37)
> 
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceI
> nvokerInterceptor.java:98)
> 
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:236)
> 
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO
> bserver.java:104)
> 
> at
> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestinati
> on.java:99)
> 
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(Servle
> tController.java:452)
> 
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController
> .java:196)
> 
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServl
> et.java:220)
> 
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServl
> et.java:153)
> 
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> ....
> Caused by: java.lang.IllegalArgumentException: wrong number of arguments
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
> 9)
> 
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> l.java:25)
> 
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractIn
> voker.java:166)
> 
> at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 82)
> 
> ... 33 more
> 
> 
> Request is:
> 
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:v29="http://test.com/services/v29";>
>    <soapenv:Header>
>       <v29:testHeader1>1234</v29:testHeader1>
>       <v29:testHeader2>abcd</v29:testHeader2>
>    </soapenv:Header>
>    <soapenv:Body>
>       <v29:getFoo/>
>    </soapenv:Body>
> </soapenv:Envelope>
> 
> 
> Generated code is:
> 
>     @WebResult(name = "response", targetNamespace = "
> http://test/services/v29";)
>     @RequestWrapper(localName = "getFoo", targetNamespace = "
> http://test.com/services/v29";, className = "com.test.services.v29.GetFoo")
>     @ResponseWrapper(localName = "getFooResponse", targetNamespace = "
> http://test.com/services/v29";, className =
> "com.test.services.v29.GetFooResponse")
>     @WebMethod(action = "http://test.com/services/v29/messages/getFoo";)
>     public com.test.services.v29.FooResponse getFo() throws TestException;
> 
> 
> Here is there wsdl:binding for the operation
> 
> <wsdl:operation name="getFoo">
> <soap:operation soapAction="" />
> <wsdl:input name="getFooRequest">
> <soap:header part="testHeader1" message="tns:testHeader1" use="literal" />
> <soap:header part="testHeader2" message="tns:testHeader2" use="literal" />
> <soap:body use="literal" parts="parameters" />
> </wsdl:input>
> <wsdl:output name="getFooResponse">
> <soap:body use="literal" />
> </wsdl:output>
> <wsdl:fault name="TestException">
> <soap:fault name="TestException" use="literal" />
> </wsdl:fault>
> </wsdl:operation>
> 
> Here are the wsdl:message for the operation from above:
> 
> <wsdl:message name="testHeader1">
> <wsdl:part element="impl:testHeader1" name="testHeader1" />
> </wsdl:message>
> 
> <wsdl:message name="testHeader2">
> <wsdl:part element="impl:testHeader2" name="testHeader2" />
> </wsdl:message>
> 
> 
> ...
> 
> <wsdl:message name="getFooRequest">
> <wsdl:part element="impl:getFoo" name="parameters" />
> </wsdl:message>
> 
> <wsdl:message name="getFooResponse">
> <wsdl:part element="impl:getFooResponse" name="parameters" />
> </wsdl:message>
> 
> 
> 
> If I remove the implicit headers, the generated code is the same and I am
> able to invoke the method with the same request. Please help. I hope I
> provided all the required information.
> 
> I've opened a JIRA ticket about this as well:
> https://issues.apache.org/jira/browse/CXF-2451
> 

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to