aspose file tools*
The moose likes Web Services and the fly likes Bean not passed to web service (SOAP / Apache CXF) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Bean not passed to web service (SOAP / Apache CXF)" Watch "Bean not passed to web service (SOAP / Apache CXF)" New topic
Author

Bean not passed to web service (SOAP / Apache CXF)

Stephane Eybert
Ranch Hand

Joined: Mar 15, 2010
Posts: 34
Hello,

I'm trying to pass a bean as an argument to a web service, but I get a NPE when trying to use the bean on the server side.

Here is the exception:


stephane@stephane-ThinkPad-X60:simplews> java -cp server/target/simplews-server-1.0-SNAPSHOT.jar no.nki.simplews.server.utils.Server
Starting Server
Jan 30, 2012 2:20:08 PM com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
INFO: Dynamically creating request wrapper Class no.nki.simplews.server.service.jaxws.SayHello
Jan 30, 2012 2:20:08 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
INFO: Dynamically creating response wrapper bean Class no.nki.simplews.server.service.jaxws.SayHelloResponse
Jan 30, 2012 2:20:08 PM com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass
INFO: Dynamically creating request wrapper Class no.nki.simplews.server.service.jaxws.SayHelloToAdmin
Jan 30, 2012 2:20:08 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
INFO: Dynamically creating response wrapper bean Class no.nki.simplews.server.service.jaxws.SayHelloToAdminResponse
Server ready...
sayHello called
sayHiToAdmin called
Jan 30, 2012 2:20:10 PM com.sun.xml.internal.ws.server.sei.EndpointMethodHandler invoke
SEVERE: null
java.lang.NullPointerException
at no.nki.simplews.server.service.impl.HelloServiceImpl.sayHelloToAdmin(HelloServiceImpl.java:20)
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 com.sun.xml.internal.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:235)
at com.sun.xml.internal.ws.server.InvokerTube$2.invoke(InvokerTube.java:135)
at com.sun.xml.internal.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:246)
at com.sun.xml.internal.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:82)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
at com.sun.xml.internal.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:232)
at com.sun.xml.internal.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:460)
at com.sun.xml.internal.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:233)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:95)
at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:65)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:554)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:526)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Server exiting


The code is some simple tutorial example I'm trying to get running:













Any clue ?

Thanks.

Stephane
Stephane Eybert
Ranch Hand

Joined: Mar 15, 2010
Posts: 34
The mistake was to return null in



instead of the object


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Bean not passed to web service (SOAP / Apache CXF)