Hi, I have been trying to convert the JAXB 2.0 example from XFire to use CXF and am having trouble with what I believe is a JAXB binding issue. I am using CVF 2.0.3. I am using the generated JAXB 2.0 java source files from the XFire example which are annotated. They are not generated with each build, but instead included in the project source.
When my WeatherServiceImpl class receives the request, the body parameter of the WebMethod is null. I have included the WeatherService interface and its implementation. I have also included my configuration file and web.xml. Any help would be greatly appreciated. I feel like I am not far off from getting working. Thanks in advance for any help, Marc Here is the WeatherService : package org.codehaus.xfire.jaxb; // START SNIPPET: service import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import net.webservicex.GetWeatherByZipCode; import net.webservicex.GetWeatherByZipCodeResponse; @WebService(name="WeatherServiceIntf", targetNamespace="http://www.webservicex.net") public interface WeatherService { @WebMethod GetWeatherByZipCodeResponse GetWeatherByZipCode(@WebParam(name="GetWeatherByZipCode") GetWeatherByZipCode body); } // END SNIPPET: service Here is the WeatherServiceImpl: package org.codehaus.xfire.jaxb; //START SNIPPET: service import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import net.webservicex.GetWeatherByZipCode; import net.webservicex.GetWeatherByZipCodeResponse; import net.webservicex.WeatherForecastsType; /** * @author mailto:[EMAIL PROTECTED] Dan Diephouse */ @WebService(endpointInterface="org.codehaus.xfire.jaxb.WeatherService", serviceName="WeatherService") @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE,use=SOAPBinding.Use.LITERAL) public class WeatherServiceImpl implements WeatherService { public GetWeatherByZipCodeResponse GetWeatherByZipCode(GetWeatherByZipCode body) { GetWeatherByZipCodeResponse res = new GetWeatherByZipCodeResponse(); //THIS NEXT LINE IS WHERE I GET A NULLPOINTEREXCEPTION String zipCode = body.getZipCode(); WeatherForecastsType weather = new WeatherForecastsType(); weather.setLatitude(1); weather.setLongitude(1); weather.setPlaceName("Vienna, AT"); weather.setAllocationFactor(1); res.setGetWeatherByZipCodeResult(weather); return res; } } //END SNIPPET: service Here the web.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:cxf-services.xml </param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>CXFServlet</servlet-name> <display-name>CXF Servlet</display-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>CXFServlet</servlet-name> <url-pattern>/cxf-services/*</url-pattern> </servlet-mapping> </web-app> Here is my configuration file, cxf-services.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <bean id="theService" class="org.codehaus.xfire.jaxb.WeatherServiceImpl"/> <bean id="jaxbContext" class="com.rulestream.core.shared.xml.JAXBContextFactoryBean"> <property name="packages" value="net.webservicex:org.codehaus.xfire.jaxb"/> </bean> <bean id="jaxbBinding" class="org.apache.cxf.jaxb.JAXBDataBinding"> <property name="context" ref="jaxbContext"/> </bean> <!-- <jaxws:endpoint id="serviceSoapEndPoint" implementor="#theService" address="/theService"> <jaxws:serviceFactory> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> <property name="dataBinding" ref="jaxbBinding"/> <property name="serviceConfigurations"> <list> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/> <bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> </list> </property> </bean> </jaxws:serviceFactory> </jaxws:endpoint> --> <jaxws:endpoint address="/WeatherService" serviceName="t:weatherService" xmlns:t="http://www.webservicex.net"> <jaxws:implementor> <bean class="org.codehaus.xfire.jaxb.WeatherServiceImpl"/> </jaxws:implementor> </jaxws:endpoint> </beans> Here is the stack trace: INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:107) at org.apache.cxf.jaxws.JAXWSMethodInvoker.createFault(JAXWSMethodInvoker.java:76) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:95) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:100) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:256) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170) at org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:148) at javax.servlet.http.HttpServlet.service(HttpServlet.java:615) at javax.servlet.http.HttpServlet.service(HttpServlet.java:688) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.jetty.Server.handle(Server.java:313) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442) Caused by: java.lang.NullPointerException at org.codehaus.xfire.jaxb.WeatherServiceImpl.GetWeatherByZipCode(WeatherServiceImpl.java:22) 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:124) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82) ... 31 more -- View this message in context: http://www.nabble.com/WebMethod-parameter-is-null---JAXB-binding-failure--tp14944996p14944996.html Sent from the cxf-user mailing list archive at Nabble.com.
