[
https://issues.apache.org/jira/browse/CXF-2451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12760438#action_12760438
]
Arik Gorelik commented on CXF-2451:
-----------------------------------
Hi Daniel,
Here is the generated code:
@WebResult(name = "response", targetNamespace =
"http://test.com/services/v29")
@RequestWrapper(localName = "getFoo", targetNamespace =
"http://test.com/services/v29", className = "com.test.services.v29.FooRequest")
@ResponseWrapper(localName = "getFooResponse", targetNamespace =
"http://test.com/services/v29", className =
"com.test.services.v29.GetFooResponse")
@WebMethod
public com.test.services.v29.FooResponse getFoo(
@WebParam(name = "testHeader1", targetNamespace =
"http://test.com/services/v29", header = true)
java.lang.String testHeader1,
@WebParam(name = "testHeader2", targetNamespace =
"http://test.com/services/v29", header = true)
java.lang.String testHeader2
) throws TestException;
This works, but my goal is different. I'd like to have a no-arg method on the
server side and I am doing a WSDL first approarch, so my implementation is
implementing a no-arg service endpoint method. As far as on the client side,
this would work and allow the clients to pass the header information to the
server.
Another experiment I've tried is I've left the implicit headers as before and
made a dummy empty element request that I've stuck to the getFooRequest message
(currently FooRequest is NO element, but I've tried with a dummy <request/>
element - being the only argument to my method getFoo) so that my request is
<getFoo><request/></getFoo>.. - that works just fine with 1 argument
[getFoo(FooRequest request)], however <getFoo/> without any arguments does not.
I've treid to debug based on the stack:
at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:152)
at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.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)
but no luck.
It seems CXF does not support having no-arg methods and implicit headers?
> Unable to call no-arg methods when using implicit headers - getting params
> [null]
> ---------------------------------------------------------------------------------
>
> Key: CXF-2451
> URL: https://issues.apache.org/jira/browse/CXF-2451
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.2.3
> Environment: ALL
> Reporter: Arik Gorelik
>
> 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(AbstractJAXWSMethodInvoker.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(ServiceInvokerInterceptor.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.java:37)
> at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
> at
> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:99)
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:452)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:196)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:220)
> at
> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.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:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.