Hello Dan,
I tried several things to debug to see what is going on.
First, I tried to test the sample spring helloworld client application as
standalone client that comes with the cxf download and it works with no
problem.
So, I copied the HelloWorld.java and HelloWorldImpl.java in my application,
did the application deploy in tomcat with the address called "/hello'
exposed for HelloWorld. Then, I ran the testcase using following:
ClientProxyFactoryBean cf = new ClientProxyFactoryBean();
cf.setAddress("http://localhost:8083/services/hello");
cf.setServiceClass(HelloWorldNew.class);
HelloWorld service = (HelloWorld) cf.create();
String test = "Hello World Test in Tomcat appserv";
String response = service.sayHi(test);
And I see following error on the server side:
Caused by: java.lang.IllegalArgumentException: object is not an instance of
declaring class
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:585)
at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:107)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:77)
which is resulting in a CxfFault with message
"org.apache.cxf.interceptor.Fault: object is not an instance of declaring
class"
With debugging, I can see that when NativeMethodAccessorImpl.invoke0 is
called, the String message I pass "Hello World Test in Tomcat appserv" is
there. So, not really sure what makes it give IllegalArgumentException.
I am attaching some of the lines I copied from debug below:
-------------------
Daemon Thread [http-8080-Processor25] (Suspended)
IllegalArgumentException.<init>(String) line: 36
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 585
BeanInvoker(AbstractInvoker).performInvocation(Exchange, Object, Method,
Object[]) line: 107
BeanInvoker(AbstractInvoker).invoke(Exchange, Object, Method, List)
line:
77
BeanInvoker(AbstractInvoker).invoke(Exchange, Object) line: 63
ServiceInvokerInterceptor$1.run() line: 56
SynchronousExecutor.execute(Runnable) line: 37
ServiceInvokerInterceptor.handleMessage(Message) line: 92
PhaseInterceptorChain.doIntercept(Message) line: 207
ChainInitiationObserver.onMessage(Message) line: 73
ServletDestination.doMessage(MessageImpl) line: 79
ServletController.invokeDestination(HttpServletRequest,
HttpServletResponse, ServletDestination) line: 235
ServletController.invoke(HttpServletRequest, HttpServletResponse) line:
140
CXFServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse)
line: 710
CXFServlet(HttpServlet).service(ServletRequest, ServletResponse) line:
803
---- the values just before it fails with the IllegalArgumentException ----
this NativeMethodAccessorImpl (id=7268)
method Method (id=7242)
numInvocations 3
parent DelegatingMethodAccessorImpl (id=7264)
arg0 "helloService"
arg1 Object[1] (id=7245)
[0] "Hello World Test in Tomcat appserv"
-------The request message seen in the tcpmon is ---------
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:sayHi
xmlns:ns1="http://comp.com/"><arg0 xmlns="http://comp.com/">Hello World Test
in Tomcat appserv</arg0></ns1:sayHi></soap:Body></soap:Envelope>
and the response is:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>object
is not an instance of declaring
class</faultstring></soap:Fault></soap:Body></soap:Envelope>
--
View this message in context:
http://www.nabble.com/having-problem-with-cxf-2.0.2-using-client-webservice-tf4524946.html#a12929605
Sent from the cxf-user mailing list archive at Nabble.com.