cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Problem with unwrapped responses containing multiple elements
Date Thu, 16 Sep 2010 02:46:00 GMT


This definitely sounds like a bug.   It should definitely be working.

Based on your messages, I assume you are using the "-exsh true" flag to the 
wsdl2java stuff to get that soap header into the method signature.  Right?

If so,  can you try NOT specifying that flag (it will remove the header from 
the method sig) for right now and seeing if that at least lets the request go 
through?

In either case, is it possible for you to create a small "hello world" type 
test case for this and attach to a JIRA?

Dan


On Wednesday 15 September 2010 6:41:53 pm justinlindh wrote:
> I'm currently using CXF 3.0-SNAPSHOT's wsdl2java utility to generate
> server-side code. When I issue a request that should be valid to the
> server, I receive an exception about "org.apache.cxf.interceptor.Fault:
> wrong number of arguments while invoking...". I'm unsure of why I'm
> receiving this exception; CXF apparently can't find the correct operation
> to route the request to, and I think it may be a bug in the way that
> Handlers are dealt with somehow.
> 
> I have request/response messages defined for an operation named 'Test' in
> my WSDL. If it's relevant, the binding does specify a request header. The
> following are the WSDL/XSD elements associated with this:
> WSDL (operation/binding parts omitted):
>     <wsdl:message name="TestRequest">
>         <wsdl:part element="rnceum:Test" name="parameters" />
>     </wsdl:message>
> 
>     <wsdl:message name="TestResponse">
>         <wsdl:part element="rnceum:TestResponse" name="parameters" />
>     </wsdl:message>
> 
> XSD elements:
> Request:
>     <xs:element name="Test">
>         <xs:complexType>
>             <xs:sequence/>
>         </xs:complexType>
>     </xs:element>
> 
> Response:
>     <xs:element name="TestResponse">
>         <xs:complexType>
>             <xs:sequence>
>                 <xs:element name="responseValueOne" type="xs:int"
> minOccurs="1" maxOccurs="1"/>
>                 <xs:element name="responseValueTwo" type="xs:int"
> minOccurs="1" maxOccurs="1"/>
>             </xs:sequence>
>         </xs:complexType>
>     </xs:element>
> 
> This creates the following operation in the generated PortType:
>     @RequestWrapper(localName = "Test", targetNamespace =
> "urn:messages.enduser.test.ws.company.com/v1", className =
> "com.company.ws.test.enduser.messages.v1.Test")
>     @WebMethod(operationName = "Test", action = "Test")
>     @ResponseWrapper(localName = "TestResponse", targetNamespace =
> "urn:messages.enduser.test.ws.company.com/v1", className =
> "com.company.ws.test.enduser.messages.v1.TestResponse")
>     public void test(
>         @WebParam(name = "ClientInfoHeader", targetNamespace =
> "urn:messages.common.test.ws.company.com/v1", header = true)
>         com.company.ws.test.common.messages.v1.ClientInfoHeader
> requestHeader,
>         @WebParam(mode = WebParam.Mode.OUT, name = "responseValueOne",
> targetNamespace = "urn:messages.enduser.test.ws.company.com/v1")
>         javax.xml.ws.Holder<java.lang.Integer> responseValueOne,
>         @WebParam(mode = WebParam.Mode.OUT, name = "responseValueTwo",
> targetNamespace = "urn:messages.enduser.test.ws.company.com/v1")
>         javax.xml.ws.Holder<java.lang.Integer> responseValueTwo
>     ) throws RequestErrorFault, UnexpectedErrorFault, InvalidURLFault,
> ServerErrorFault;
> 
> In my PortTypeImpl class, I have the following function declaration
> (auto-generated by IDE off of the PortType class):
>     @Override
>     public void test(ClientInfoHeader requestHeader, Holder<Integer>
> responseValueOne, Holder<Integer> responseValueTwo) throws
> RequestErrorFault, UnexpectedErrorFault, InvalidURLFault, ServerErrorFault
>     {
>         throw new UnsupportedOperationException("Not supported yet.");
>     }
> 
> When I issue the following XML request, I receive the error:
> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
> <s:Header>
> <h:ClientInfoHeader xmlns:h="urn:messages.common.test.ws.company.com/v1"
> xmlns="urn:messages.common.test.ws.company.com/v1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>     <AppID>C# Test App</AppID>
> </h:ClientInfoHeader>
> </s:Header>
> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>     <Test xmlns="urn:messages.enduser.test.ws.company.com/v1"/>
> </s:Body>
> </s:Envelope>
> 
> The error follows:
> Sep 15, 2010 4:17:01 PM org.apache.cxf.phase.PhaseInterceptorChain
> doDefaultLogging
> WARNING: Application
> {urn:wsdl.enduser.test.ws.company.com/v1}WSEndUserService#{urn:wsdl.enduser
> .test.ws.company.com/v1}Test has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: wrong number of arguments while invoking
> public void
> com.company.ws.test.enduser.wsdl.v1.WSEndUserPortTypeImpl.test(com.company.
> ws.test.common.messages.v1.ClientInfoHeader,javax.xml.ws.Holder,javax.xml.w
> s.Holder) throws
> com.company.ws.test.enduser.wsdl.v1.RequestErrorFault,com.company.ws.test.e
> nduser.wsdl.v1.UnexpectedErrorFault,com.company.ws.test.enduser.wsdl.v1.Inv
> alidURLFault,com.company.ws.test.enduser.wsdl.v1.ServerErrorFault with
> params [].
>         at
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.
> java:159) at
> org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMe
> thodInvoker.java:86) at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 133) at
> org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
>         at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 75) 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:106) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:244) at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationO
> bserver.java:110) at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jet
> tyHTTPDestination.java:311) at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTT
> PDestination.java:275) at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandle
> r.java:70) at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>         at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>         at
> org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCol
> lection.java:230) at
> org.mortbay.jetty.handler.HandlerList.handle(HandlerList.java:49) at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>         at org.mortbay.jetty.Server.handle(Server.java:326)
>         at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>         at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java
> :943) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410
> ) at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.j
> ava:886) at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:
> 908) at java.lang.Thread.run(Thread.java:619)
> 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:173) at
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:
> 89) ... 28 more
> 
> It's as if the server is expecting me to somehow specify the Holders as
> parameters in the XML somehow, but that's incorrect. Is there something I'm
> doing wrong, or could this possibly be a bug in CXF? Any help is greatly
> appreciated!

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message