Unable to find resolve annotations
Hello -- I am trying to use RESTful annotations to create an HTTP service, and build using Maven 2. I have followed the instructions in the documentation for adding the appropriate dependencies, repositories, and plugin repositories. However, my service class that I'm trying to annotate using the @Get and @HttpResource annotations fail build, because those annotations cannot be resolved. I have the following cxf dependencies listed in the pom.xml for my project: org.apache.cxf cxf-rt-frontend-jaxws 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http-jetty 2.0-incubator-SNAPSHOT Can someone give me a head's up of why these annotations cannot be resolved? I am using Jsdk 1.5.0_11. Thanks, Brad
Re: Unable to find resolve annotations
Willem, Thanks! I have one more question. If I am using REST ful annotations to create an HTTP service, and I don't need to make use of SOAP or any wsdl support (i.e., I want XML over straight HTTP only), which dependencies do I need? Based upon the dependency names, I am suspecting that I don't need all of the ones listed in the example in the documentation. Thanks! Brad Willem Jiang wrote: Hi Brad, You need to add the jra in you dependency org.codehaus.jra jra 1.0-alpha-3 Cheers, Willem Brad O'Hearne wrote: Hello -- I am trying to use RESTful annotations to create an HTTP service, and build using Maven 2. I have followed the instructions in the documentation for adding the appropriate dependencies, repositories, and plugin repositories. However, my service class that I'm trying to annotate using the @Get and @HttpResource annotations fail build, because those annotations cannot be resolved. I have the following cxf dependencies listed in the pom.xml for my project: org.apache.cxf cxf-rt-frontend-jaxws 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http-jetty 2.0-incubator-SNAPSHOT Can someone give me a head's up of why these annotations cannot be resolved? I am using Jsdk 1.5.0_11. Thanks, Brad
Re: Unable to find resolve annotations
Willem, Thanks for the reply -- unfortunately, I couldn't find what you were referring to in the English text on this site, and I cannot read Chinese characters. :-) Brad Willem Jiang wrote: You can take the http-binding pom.xml as a example: http://willem.bokeland.com/svn.apache.org/repos/asf/incubator/cxf/trunk/rt/bindings/http/pom.xml Willem. Brad O'Hearne wrote: Willem, Thanks! I have one more question. If I am using REST ful annotations to create an HTTP service, and I don't need to make use of SOAP or any wsdl support (i.e., I want XML over straight HTTP only), which dependencies do I need? Based upon the dependency names, I am suspecting that I don't need all of the ones listed in the example in the documentation. Thanks! Brad Willem Jiang wrote: Hi Brad, You need to add the jra in you dependency org.codehaus.jra jra 1.0-alpha-3 Cheers, Willem Brad O'Hearne wrote: Hello -- I am trying to use RESTful annotations to create an HTTP service, and build using Maven 2. I have followed the instructions in the documentation for adding the appropriate dependencies, repositories, and plugin repositories. However, my service class that I'm trying to annotate using the @Get and @HttpResource annotations fail build, because those annotations cannot be resolved. I have the following cxf dependencies listed in the pom.xml for my project: org.apache.cxf cxf-rt-frontend-jaxws 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http 2.0-incubator-SNAPSHOT org.apache.cxf cxf-rt-transports-http-jetty 2.0-incubator-SNAPSHOT Can someone give me a head's up of why these annotations cannot be resolved? I am using Jsdk 1.5.0_11. Thanks, Brad
Need to eliminate use of SOAP for Http-REST
Hello, I have followed the instructions in the documentation for RESTful services to with the intention of creating a pure Http-XML service without SOAP. However, when I hit one of my service URL's from a browser (without parameters, just to see what would happen) I get the following: soap:Server wrong number of arguments I do not want to use SOAP. I want only an XML document passed as a parameter over Http -- no SOAP. This seems to indicate that SOAP is still in the mix, but I need to remove it. I have this configured in Spring, according to the documentation. Here is the content of my spring beans.xml (verbatim from the doc): 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";> Here is the content of my web.xml, verbatim from the doc: http://java.sun.com/dtd/web-app_2_3.dtd";> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /* How do I remove SOAP from the mix? Thanks! Brad
How to configure HTTP-Binding with Spring
How do I configure the RESTful HTTP-binding with Spring, as opposed to the SOAP binding given in the documentation? Thanks, Brad
Re: How to configure HTTP-Binding with Spring
718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) 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.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412) Jul 13, 2007 2:46:07 PM org.apache.catalina.core.StandardContext listenerStart Thanks, Brad Dan Diephouse wrote: This should definitely make its way in the docs, but here is an example from the mailing list earlier: resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" /> http://apache.org/cxf/binding/http";> Hope that helps, - Dan On 7/13/07, Brad O'Hearne <[EMAIL PROTECTED]> wrote: How do I configure the RESTful HTTP-binding with Spring, as opposed to the SOAP binding given in the documentation? Thanks, Brad
Exception loading CXF service in Spring with HTTP Binding
I am loading a simple CXF service using Spring, and an HTTP Binding. It is throwing an Exception, which unfortunately is very cryptic, gives me no idea of what the problem is, or how to fix it, and there's not any solution I can find in the documentation or by searching in Google. Does anyone have any idea what this Exception means and/or how to fix it? Thanks...output is below: ERROR [main] (ContextLoader.java:203) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Invocation of init method failed; nested exception is java.lang.IndexOutOfBoundsException: No group 1 Caused by: java.lang.IndexOutOfBoundsException: No group 1 at java.util.regex.Matcher.group(Matcher.java:463) at java.util.regex.Matcher.appendReplacement(Matcher.java:730) at java.util.regex.Matcher.replaceAll(Matcher.java:806) at org.apache.cxf.binding.http.strategy.Inflector.pluralize(Inflector.java:72) at org.apache.cxf.binding.http.strategy.ConventionStrategy.extractNoun(ConventionStrategy.java:148) at org.apache.cxf.binding.http.strategy.ConventionStrategy.map(ConventionStrategy.java:88) at org.apache.cxf.binding.http.HttpBindingFactory.createBindingInfo(HttpBindingFactory.java:100) at org.apache.cxf.frontend.AbstractEndpointFactory.createBindingInfo(AbstractEndpointFactory.java:274) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.createBindingInfo(JaxWsServerFactoryBean.java:124) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpointInfo(AbstractEndpointFactory.java:191) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:105) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:89) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:142) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:223) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:175) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:329) 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1240) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1205) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3826) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4335) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:824) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:713) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:489) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1137) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.ap
Re: Exception loading CXF service in Spring with HTTP Binding
I'm appealing to anyone out there who can please help me with this problem. All I'm trying to do is standard configuration of a single service, with a single method, using Http binding, using Spring. If I cannot get this problem resolved soon, as much as I do not want to, I'm going to have to punt usage of both CXF and XFire, which I am migrating from. Simple, SOAP-free, RESTful HTTP service invocations configured in Spring -- that's it. The documentation says that this can be done, but doesn't give a complete description of how this can be done; Google gives a reference from last month about this, but no answers, and the API samples don't shed any light on it. It seems my configuration is close, but I'm starting to wonder if Http Binding in CXF actually works, as the there is little to no information available on it. If anyone is in the know about how to get this to work, I'd greatly appreciate it. I'm up against a deadline and I'll have to roll my own service stack if I have to wait several days to get this resolved. Thanks in advance for your help. Brad Brad O'Hearne wrote: I am loading a simple CXF service using Spring, and an HTTP Binding. It is throwing an Exception, which unfortunately is very cryptic, gives me no idea of what the problem is, or how to fix it, and there's not any solution I can find in the documentation or by searching in Google. Does anyone have any idea what this Exception means and/or how to fix it? Thanks...output is below: ERROR [main] (ContextLoader.java:203) - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Invocation of init method failed; nested exception is java.lang.IndexOutOfBoundsException: No group 1 Caused by: java.lang.IndexOutOfBoundsException: No group 1 at java.util.regex.Matcher.group(Matcher.java:463) at java.util.regex.Matcher.appendReplacement(Matcher.java:730) at java.util.regex.Matcher.replaceAll(Matcher.java:806) at org.apache.cxf.binding.http.strategy.Inflector.pluralize(Inflector.java:72) at org.apache.cxf.binding.http.strategy.ConventionStrategy.extractNoun(ConventionStrategy.java:148) at org.apache.cxf.binding.http.strategy.ConventionStrategy.map(ConventionStrategy.java:88) at org.apache.cxf.binding.http.HttpBindingFactory.createBindingInfo(HttpBindingFactory.java:100) at org.apache.cxf.frontend.AbstractEndpointFactory.createBindingInfo(AbstractEndpointFactory.java:274) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.createBindingInfo(JaxWsServerFactoryBean.java:124) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpointInfo(AbstractEndpointFactory.java:191) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:105) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:89) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:142) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:223) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:175) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:329) 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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1240) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1205) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.co
Re: Need to eliminate use of SOAP for Http-REST
Jervis, Thanks for the reply. An update on the situation -- there is (was) a bug here, which Dan Diephouse is addressing. He found me a workaround to my problem for now. Brad Liu, Jervis wrote: Hi Brad, Currently there are two ways to build RESTful service with CXF, using CXF HTTP binding or using JAX-WS Dispatch/Provider API. JAX-WS Dispatch/Provider approach is just using JAX-WS API, so it is SOAP/HTTP based (but you can also configure it to use XML binding instead). CXF HTTP binding maps operations from URI or HTTP verbs, the input parameters can be extracted from URL or Http payload using different content types such as POX or JSON, it definitely does not need SOAP in this case. I can not tell which approach you are using from the code snippet you have enclosed, I will need your com.nextrials.kilter.service.user.UserService class. But it seems that you are using JAX-WS Dispatch/Provider approach otherwise you wont get back an error message wrapped with SOAP Envelope. Cheers, Jervis -Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 2007?7?14? 1:39 To: cxf-user@incubator.apache.org Subject: Need to eliminate use of SOAP for Http-REST Hello, I have followed the instructions in the documentation for RESTful services to with the intention of creating a pure Http-XML service without SOAP. However, when I hit one of my service URL's from a browser (without parameters, just to see what would happen) I get the following: soap:Server wrong number of arguments I do not want to use SOAP. I want only an XML document passed as a parameter over Http -- no SOAP. This seems to indicate that SOAP is still in the mix, but I need to remove it. I have this configured in Spring, according to the documentation. Here is the content of my spring beans.xml (verbatim from the doc): 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";> Here is the content of my web.xml, verbatim from the doc: http://java.sun.com/dtd/web-app_2_3.dtd";> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /* How do I remove SOAP from the mix? Thanks! Brad IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Need to eliminate use of SOAP for Http-REST
Actually, I don't know (yet) if it is fixed. It may be a new problem, or may be linked to the same thing, but I'll mention in another post here in a moment, this RESTful configuration crashes with the introduction of a method on my service with a return type of "Collection", and it not only crashes that method, but it appears all methods on the service. I'll be describing this further in another post. Brad Liu, Jervis wrote: Opps, just saw that long discussion, glad to see the problem has fixed (or will be fixed :-)). Cheers, Jervis -Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 2007?7?16? 10:22 To: cxf-user@incubator.apache.org Subject: Re: Need to eliminate use of SOAP for Http-REST Jervis, Thanks for the reply. An update on the situation -- there is (was) a bug here, which Dan Diephouse is addressing. He found me a workaround to my problem for now. Brad Liu, Jervis wrote: Hi Brad, Currently there are two ways to build RESTful service with CXF, using CXF HTTP binding or using JAX-WS Dispatch/Provider API. JAX-WS Dispatch/Provider approach is just using JAX-WS API, so it is SOAP/HTTP based (but you can also configure it to use XML binding instead). CXF HTTP binding maps operations from URI or HTTP verbs, the input parameters can be extracted from URL or Http payload using different content types such as POX or JSON, it definitely does not need SOAP in this case. I can not tell which approach you are using from the code snippet you have enclosed, I will need your com.nextrials.kilter.service.user.UserService class. But it seems that you are using JAX-WS Dispatch/Provider approach otherwise you wont get back an error message wrapped with SOAP Envelope. Cheers, Jervis -----Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 2007?7?14? 1:39 To: cxf-user@incubator.apache.org Subject: Need to eliminate use of SOAP for Http-REST Hello, I have followed the instructions in the documentation for RESTful services to with the intention of creating a pure Http-XML service without SOAP. However, when I hit one of my service URL's from a browser (without parameters, just to see what would happen) I get the following: soap:Server wrong number of arguments I do not want to use SOAP. I want only an XML document passed as a parameter over Http -- no SOAP. This seems to indicate that SOAP is still in the mix, but I need to remove it. I have this configured in Spring, according to the documentation. Here is the content of my spring beans.xml (verbatim from the doc): 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";> Here is the content of my web.xml, verbatim from the doc: http://java.sun.com/dtd/web-app_2_3.dtd";> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /* How do I remove SOAP from the mix? Thanks! Brad IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
CXF crashing, unable to process a Collection type
I have a RESTful service configured with Spring. Here is the interface: @WebService public interface IUserService { @Post @HttpResource(location="/authenticate") AuthenticateResponse authenticate(AuthenticateRequest request) throws KilterException; @Post @HttpResource(location="/getEntities") ArrayList getUsers(GetUsersRequest request) throws KilterException; } This service works without error. However, I made one change, which was changing the return type of the getUsers method from the ArrayList listed to a Collection, as follows: @Post @HttpResource(location="/getEntities") Collection getUsers(GetUsersRequest request) throws KilterException; This was the ONLY change made. Though my server loaded the service without error, oddly, invoking the authenticate method, in the same way as before, with the same exact data, resulted in the following exception (NOTE: the code of my actual service was never invoked, this exception occurred in the CXF API which was processing parameters). So apparently, this Collection type, though on the getUsers method, prevented the authenticate method from being invoked. ??? Does anyone have any idea why this would be, and how to rectify it? The exception is below: INFO: Invoking POST on /authenticate Jul 15, 2007 8:59:17 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/authenticate] with content-type [application/xml] Jul 15, 2007 8:59:17 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org.apache.cxf.binding.http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:264) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java:124) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage(URIParameterInInterceptor.java:105) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:100) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:224) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:103) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:239) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:270) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444) at java.lang.Thread.run(Thread.java:595) Thanks, Brad
Re: CXF crashing, unable to process a Collection type
The plot thickens. I changed the code back, so that Collection was no longer there, and the orginal ArrayList is there. The code is *still* crashing however. My input has not changed -- it is hard-coded, so I know for a fact it has not changed. I am now suspecting some new resource that may have been posted to an online maven repository, because that's the only thing I can think of that could have injected new code into my code-base, as I am building with maven. Is anyone aware of any new CXF artifact or dependency that has hit public maven repositories within the last day? Thanks, Brad Brad O'Hearne wrote: I have a RESTful service configured with Spring. Here is the interface: @WebService public interface IUserService { @Post @HttpResource(location="/authenticate") AuthenticateResponse authenticate(AuthenticateRequest request) throws KilterException; @Post @HttpResource(location="/getEntities") ArrayList getUsers(GetUsersRequest request) throws KilterException; } This service works without error. However, I made one change, which was changing the return type of the getUsers method from the ArrayList listed to a Collection, as follows: @Post @HttpResource(location="/getEntities") Collection getUsers(GetUsersRequest request) throws KilterException; This was the ONLY change made. Though my server loaded the service without error, oddly, invoking the authenticate method, in the same way as before, with the same exact data, resulted in the following exception (NOTE: the code of my actual service was never invoked, this exception occurred in the CXF API which was processing parameters). So apparently, this Collection type, though on the getUsers method, prevented the authenticate method from being invoked. ??? Does anyone have any idea why this would be, and how to rectify it? The exception is below: INFO: Invoking POST on /authenticate Jul 15, 2007 8:59:17 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/authenticate] with content-type [application/xml] Jul 15, 2007 8:59:17 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org.apache.cxf.binding.http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:264) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java:124) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage(URIParameterInInterceptor.java:105) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:100) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:224) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:103) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:239) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:270) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444) at java.lang.Thread.run(Thread.java:595) Thanks, Brad
Re: CXF crashing, unable to process a Collection type
Dan, Thanks for the reply. I think I may have been in error, but perhaps I stumbled across something new. I actually did have one more change. The two methods mentioned were both annotated with the same @WebResult name, though the types were different, as follows: @Post @HttpResource(location="/authenticate") @WebResult (name = "ServiceResponse") AuthenticateResponse authenticate(AuthenticateRequest request) throws KilterException; @Post @HttpResource(location="/getEntities") @WebResult (name = "ServiceResponse") Collection getUsers(GetUsersRequest request) throws KilterException; I am sure this probably is due to the web service underpinnings here -- and that schema types have to be unique. But as I'm not using WSDLs or SOAP, but RESTful services, this didn't immediately occur to me. However, it may or may not be worth pointing out that what was trying to be accomplished here was a common wrapper placed on the response, for processing on the client. It might seem an alternative to accomplish this via a common return type, as in this: @Post @HttpResource(location="/authenticate") ServiceResponse authenticate(AuthenticateRequest request) throws KilterException; @Post @HttpResource(location="/getEntities") ServiceResponse getUsers(GetUsersRequest request) throws KilterException; This is actually what I originally tried, but the problem is that in order to return different data, ServiceResponse has to look something like this: public class ServiceResponse { public Object data; } In this case, CXF croaks on the data property, as each method will assign an object of different structure. I do not know the internals of CXF, but what would be really great is if one of two things (or both) could be possible in the non-SOAP, non-schema-bound world of RESTful services: 1) @WebResult name annotations were namespaced by the method they were associated with, so that multiple web methods could have the same result name, thereby resulting in a common wrapper object returned, though the internal structure was different. 2) Perhaps an alternative to 1), or maybe in addition to, dynamic, runtime databinding to property types sent in, so that a class like the ServiceResponse object above can be assigned different object structures to its data property, and be successfully processed. As it is, the client receiving the response cannot be response-agnostic to a common response wrapper, but must have carnal knowledge of the literal response name/type in order to receive it. Doing either of the two above might preserve a polymorphic ability of payload processing on the client end. Anyway, I'd be interested in knowing if the annotation issue above was something known -- I'm sure it is, but want to make sure that I was dealing with the actual problem, not merely a symptom of something else. Thanks, Brad Dan Diephouse wrote: JAXB tends to not work very well with Collections/Lists IMO - at least not right on the parameter class. You may want to try using the Aegis databinding which works quite well with them. I'll see if I can churn out a test case though for this and see what might be wrong. - Dan On 7/15/07, Brad O'Hearne <[EMAIL PROTECTED]> wrote: The plot thickens. I changed the code back, so that Collection was no longer there, and the orginal ArrayList is there. The code is *still* crashing however. My input has not changed -- it is hard-coded, so I know for a fact it has not changed. I am now suspecting some new resource that may have been posted to an online maven repository, because that's the only thing I can think of that could have injected new code into my code-base, as I am building with maven. Is anyone aware of any new CXF artifact or dependency that has hit public maven repositories within the last day? Thanks, Brad Brad O'Hearne wrote: > I have a RESTful service configured with Spring. Here is the interface: > > @WebService > public interface IUserService { > @Post >@HttpResource(location="/authenticate") >AuthenticateResponse authenticate(AuthenticateRequest request) > throws KilterException; > >@Post >@HttpResource(location="/getEntities") >ArrayList getUsers(GetUsersRequest request) throws > KilterException; > > } > > > This service works without error. However, I made one change, which > was changing the return type of the getUsers method from the ArrayList > listed to a Collection, as follows: > >@Post >@HttpResource(location="/getEntities") >Collection getUsers(GetUsersRequest request) throws > KilterException; > > > This was the ONLY change made. Though my server loaded the service > without error, oddly, invoking the authenticate method
Re: CXF crashing, unable to process a Collection type
Dan, Thanks for the reply. I think the problem was on my end, (see other post I just made in this thread to Dan), but I'm not entirely sure if what was mentioned was a symptom, or the problem itself. Cheers, Brad Daniel Kulp wrote: I published new CXF snapshots Saturday morning.If you're using the snapshots, that could have done it. Dan On Monday 16 July 2007 00:51, Brad O'Hearne wrote: The plot thickens. I changed the code back, so that Collection was no longer there, and the orginal ArrayList is there. The code is *still* crashing however. My input has not changed -- it is hard-coded, so I know for a fact it has not changed. I am now suspecting some new resource that may have been posted to an online maven repository, because that's the only thing I can think of that could have injected new code into my code-base, as I am building with maven. Is anyone aware of any new CXF artifact or dependency that has hit public maven repositories within the last day? Thanks, Brad Brad O'Hearne wrote: I have a RESTful service configured with Spring. Here is the interface: @WebService public interface IUserService { @Post @HttpResource(location="/authenticate") AuthenticateResponse authenticate(AuthenticateRequest request) throws KilterException; @Post @HttpResource(location="/getEntities") ArrayList getUsers(GetUsersRequest request) throws KilterException; } This service works without error. However, I made one change, which was changing the return type of the getUsers method from the ArrayList listed to a Collection, as follows: @Post @HttpResource(location="/getEntities") Collection getUsers(GetUsersRequest request) throws KilterException; This was the ONLY change made. Though my server loaded the service without error, oddly, invoking the authenticate method, in the same way as before, with the same exact data, resulted in the following exception (NOTE: the code of my actual service was never invoked, this exception occurred in the CXF API which was processing parameters). So apparently, this Collection type, though on the getUsers method, prevented the authenticate method from being invoked. ??? Does anyone have any idea why this would be, and how to rectify it? The exception is below: INFO: Invoking POST on /authenticate Jul 15, 2007 8:59:17 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/authenticate] with content-type [application/xml] Jul 15, 2007 8:59:17 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org.apache.cxf.binding.http.IriDecoderHelper.interopolateParams(IriD ecoderHelper.java:264) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.me rgeParams(URIParameterInInterceptor.java:124) at org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.ha ndleMessage(URIParameterInInterceptor.java:105) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercep torChain.java:206) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInit iationObserver.java:67) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(Servle tDestination.java:100) at org.apache.cxf.transport.servlet.ServletController.invokeDestination (ServletController.java:224) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletCon troller.java:103) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:2 61) at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:2 39) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App licationFilterChain.java:270) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application FilterChain.java:191) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper Valve.java:227) at org.apache.catalina.core.StandardContextValve.invoke(StandardContext Valve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve. java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve. java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa lve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.ja va:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.jav a:817) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proc ess(Http11Protocol.java:623) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:4 44) at java.lang.Thread.run(Thread.java:595) Thanks, Brad
Cannot run more than one RESTful service
Hello, I am having problems running more than one RESTful service, loaded via Spring. Without going into the nasties of how this was determined, with the help of a developer, it was determined that the present means of configuring a RESTful service with Spring was as follows (in my beans.xml file): http://apache.org/cxf/binding/http"; /> This service, when configured as the only service in my beans.xml file, loads and is invoked successfully. But when I add a second service to my beans.xml, as follows: http://apache.org/cxf/binding/http"; /> When I deploy and start my server, on load I get no errors. But I also do not see this second service produce output in the server logs like the first one does. The first service, I see this in the logs: INFO: Creating Service {http://user.brad.com/}IUserServiceService from class com.brad.user.IUserService But I do not see this for my second (ISponsorService) service. When I try to invoke *either* service, CXF crashes. The stack trace is below. Does anyone have any idea how to configure and successfully run more than one RESTful service using Spring? Thanks in advance for help!!! Brad Stack trace, when trying to invoke the authenticate method on IUserService, that is known to work, with data known to work, when 2 services are configured (this does not happen when only one service has been configured). INFO: URIParameterInterceptor handle message on path [/authenticate] with content-type [application/xml] Jul 16, 2007 4:11:03 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: object is not an instance of declaring class at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:88) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:82) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:56) 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:87) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:206) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:67) at org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:100) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:224) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:103) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:239) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:270) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:227) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:623) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444) at java.lang.Thread.run(Thread.java:595) Brad
Re: Cannot run more than one RESTful service
Dan, You are 100% correct. This solved the problem! Thanks! Brad Dan Diephouse wrote: Hi Brad, The JaxWsServiceFactoryBean is not resusable across various services. Try embedding it inside your service definition: ... Let me know if that helps! - Dan On 7/16/07, Brad O'Hearne <[EMAIL PROTECTED]> wrote: Hello, I am having problems running more than one RESTful service, loaded via Spring. Without going into the nasties of how this was determined, with the help of a developer, it was determined that the present means of configuring a RESTful service with Spring was as follows (in my beans.xml file): http://apache.org/cxf/binding/http"; /> This service, when configured as the only service in my beans.xml file, loads and is invoked successfully. But when I add a second service to my beans.xml, as follows: http://apache.org/cxf/binding/http"; /> When I deploy and start my server, on load I get no errors. But I also do not see this second service produce output in the server logs like the first one does. The first service, I see this in the logs: INFO: Creating Service {http://user.brad.com/}IUserServiceService from class com.brad.user.IUserService But I do not see this for my second (ISponsorService) service. When I try to invoke *either* service, CXF crashes. The stack trace is below. Does anyone have any idea how to configure and successfully run more than one RESTful service using Spring? Thanks in advance for help!!! Brad Stack trace, when trying to invoke the authenticate method on IUserService, that is known to work, with data known to work, when 2 services are configured (this does not happen when only one service has been configured). INFO: URIParameterInterceptor handle message on path [/authenticate] with content-type [application/xml] Jul 16, 2007 4:11:03 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: object is not an instance of declaring class at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java :88) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:82) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java :56) 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:87) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept( PhaseInterceptorChain.java:206) at org.apache.cxf.transport.ChainInitiationObserver.onMessage( ChainInitiationObserver.java:67) at org.apache.cxf.transport.servlet.ServletDestination.doMessage( ServletDestination.java:100) at org.apache.cxf.transport.servlet.ServletController.invokeDestination( ServletController.java:224) at org.apache.cxf.transport.servlet.ServletController.invoke( ServletController.java:103) at org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) at org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:239) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:270) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:191) at org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:227) at org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :104) at org.apache.catalina.core.StandardEngineValve.invoke( StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java :211) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:817) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( Http11Protocol.java:623) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:444) at java.lang.Thread.run(Thread.java:595) Brad
Serialization of XML attributes to Java Types
Hello, I am using CXF HTTP RESTful invocations, and I have been successfully using the default serialization in CXF to convert XML such as the following: value 1 value 2 to a Java object such as: public class MyObject { private String myVar1; private String myVar2; // What I would like to do, is change the serialization so that attributes map to Java properties, so that using the same Java object above, the following XML would properly map using CXF: Can someone enlighten me as to how this is done? That is step 1. The second step is to map other object types to properties, as in: value 1 value 2 mapping to these Java classes: public class MyObject { private MyChildObject myChildObject; //
Problem loading REST service
Hello, I have what is probably a fairly simple problem. I am trying to load a RESTful service in Tomcat 6.x using Spring. When I start Tomcat, I receive an Exception -- here's the Exception received: INFO: Creating Service {http:// us.service.brad.com/}IUserServiceService from class com.brad.service.us.IUserService Apr 1, 2008 12:01:48 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in ServletContext resource [/WEB-INF/beans.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lang/String; Caused by: java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getInputEncoding()Ljava/lang/String; 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.ws.commons.schema.utils.DOMUtil.getInputEncoding(DOMUtil.java: 594) at org .apache .ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java: 348) at org .apache .cxf .databinding .source.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java: 73) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:224) at org .apache .cxf .service .factory .ReflectionServiceFactoryBean .buildServiceFromClass(ReflectionServiceFactoryBean.java:293) at org .apache .cxf .service .factory .ReflectionServiceFactoryBean .initializeServiceModel(ReflectionServiceFactoryBean.java:333) at org .apache .cxf .service .factory .ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java: 151) at org .apache .cxf .jaxws .support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:93) at org .apache .cxf .frontend .AbstractWSDLBasedEndpointFactory .createEndpoint(AbstractWSDLBasedEndpointFactory.java:74) at org .apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java: 108) at org .apache .cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java: 147) Here is my web.xml: http://java.sun.com/dtd/web-app_2_3.dtd";> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 NonCXFDispatcher Non-CXF Servlet org.springframework.web.servlet.DispatcherServlet 1 NonCXFDispatcher /ncservices/* CXFServlet /services/* Here is my beans.xml 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";> http://apache.org/cxf/binding/http";> Does anyone have any idea what the problem is? I have been through all of the documentation and I cannot see the problem. I am wondering if there is some potential dependency issue. I have tried both the 2.0.3 and 2.0.4 versions of the CXF jars, and I have also tried using the spring bean approach in the beans.xml file instead of the jaxws endpoint approach. Everything produces the same error. Your help is appreciated! Thanks, Brad
Removing namespaces on serialized responses
Hello, I am using CXF RESTful services configured in Spring, using JAXB. I am having some namespace conflicts between my client and server, and I was wondering if (for the time being) there was a way to configure CXF/ JAXB not to write a namespace into the serialized object that is returned from a service method. Does anyone know how to do this and maybe can post a snippet? Thanks, Brad
Base class members not serializing / deserializing
Hello, I am using CXF with RESTful services, configured with Spring. My request objects (parameters to my service methods) and response objects (return types on my service methods) have a common structure, so I created some base classes with common members, which the actual request and response objects I use and declare as types in my service interface method signatures, and have discovered something horrible...which I hope is something only as horrible as my lack of knowledge on how to change the default behavior. Apparently, all members defined on the base classes are ignored when the serialization / deserialization binding occurs, and I receive NullPointerExceptions. If I take all the members defined in my base classes and stuff them into their subclasses, everything works fine. Obviously, this is a bad scene, as it requires me to duplicate code across every request and response object, respectively. How do I alter the CXF behavior (using JAXB) so that I can have my request and response types extend from base classes and have those base class members serialize and deserialize properly? Thanks, Brad
Re: Base class members not serializing / deserializing
I thought I'd add some sample code: My superclass: @XmlType public abstract class ServiceRequest { private String ssid; @XmlAttribute public String getSsid() { return ssid; } public void setSsid(String ssid) { this.ssid = ssid; } } My impl class: @XmlRootElement //I have tried both @XmlType and nothing here, no luck public class ListServersRequest extends ServiceRequest { } My service method: @Post @HttpResource(location = "/listServers") @WebResult (name = "ListServersResponse") .ListServersResponse listServers(ListServersRequest request); It never reaches the method. I get the following error: INFO: Invoking POST on /listServers Apr 4, 2008 10:03:55 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/listServers] with content-type [application/xml] Apr 4, 2008 10:03:55 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org .apache .cxf .binding .http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:306) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java: 122) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .handleMessage(URIParameterInInterceptor.java:103) at org .apache .cxf .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208) at org .apache .cxf .transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) at org .apache .cxf .transport .servlet.ServletDestination.doMessage(ServletDestination.java:79) at org .apache .cxf .transport .servlet.ServletController.invokeDestination(ServletController.java:264) at org .apache .cxf.transport.servlet.ServletController.invoke(ServletController.java: 123) 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:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) If I rip the content from ServiceResponse and put it directly into ListServersResponse, everything works. Otherwise, everything fails. If anyone has any clue, I'd appreciate the help! Brad On Apr 4, 2008, at 6:47 PM, Brad O'Hearne wrote: Hello, I am using CXF with RESTful services, configured with Spring. My request objects (parameters to my service methods) and response objects (return types on my service methods) have a common structure, so I created some base classes with common members, which the actual request and response objects I use and declare as types in my service interface method signatures, and have discovered something horrible...which I hope is something only as horrible as my lack of knowledge on how to change the default behavior. Apparently, all members defined on the base classes are ignored when the serialization / deserialization binding occurs, and I receive NullPointerExceptions. If I take all the members defined in my base classes and stuff them into their subclasses, everything works fine. Obviously, this is a bad scene, as it requires me to duplicate code across every request and response object, respectively. How do I alter the CXF behavior (using JAXB) so that I can have my request and response types extend from base classes and have those base class members serialize and deserialize properly? Thanks, Brad
Re: Base class members not serializing / deserializing
Sergey, Thanks for the reply -- I've made my code changes, but I'm finding that I cannot resolve my jax-rs annotations -- what JAR (maven artifact) contains the needed jax-rs dependencies? Thanks, Brad On Apr 5, 2008, at 3:22 AM, Beryozkin, Sergey wrote: Hi Brad Yes, I can see you're using CXF HTTP Binding. I'd encourage you to try JAX-RS, not sure why it does not work in CXF HTTP Binding. With CXF JAX-RS you'd also have few options to plugin your custom serializers and deal with that namespace issue... Cheers, Sergey -Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 05 April 2008 06:20 To: cxf-user@incubator.apache.org Subject: Re: Base class members not serializing / deserializing I thought I'd add some sample code: My superclass: @XmlType public abstract class ServiceRequest { private String ssid; @XmlAttribute public String getSsid() { return ssid; } public void setSsid(String ssid) { this.ssid = ssid; } } My impl class: @XmlRootElement //I have tried both @XmlType and nothing here, no luck public class ListServersRequest extends ServiceRequest { } My service method: @Post @HttpResource(location = "/listServers") @WebResult (name = "ListServersResponse") .ListServersResponse listServers(ListServersRequest request); It never reaches the method. I get the following error: INFO: Invoking POST on /listServers Apr 4, 2008 10:03:55 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/listServers] with content-type [application/xml] Apr 4, 2008 10:03:55 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org .apache .cxf .binding .http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:306) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java: 122) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .handleMessage(URIParameterInInterceptor.java:103) at org .apache .cxf .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 208) at org .apache .cxf .transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) at org .apache .cxf .transport .servlet.ServletDestination.doMessage(ServletDestination.java:79) at org .apache .cxf .transport .servlet.ServletController.invokeDestination(ServletController.java: 264) at org .apache .cxf .transport.servlet.ServletController.invoke(ServletController.java: 123) 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:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 109) at org .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) If I rip the content from ServiceResponse and put it directly into ListServersResponse, everything works. Otherwise, everything fails. If anyone has any clue, I'd appreciate the help! Brad On Apr 4, 2008, at 6:47 PM, Brad O'Hearne wrote: Hello, I am using CXF with RESTful services, configured with Spring. My request objects (parameters to my service methods) and response objects (return types on my service methods) have a common structure, so I created some base classes with common members, which the actual request and response objects I use and declare as types in my service interface method signatures, and have discovered something horrible...which I hope is something only as horri
Re: Base class members not serializing / deserializing
Come to think of itI'm not seeing any cxf-rt-frontend-jaxrs on the incubating repository. Where can this dependency be found? None of my annotations will compile. B On Apr 5, 2008, at 3:29 PM, Brad O'Hearne wrote: Sergey, Thanks for the reply -- I've made my code changes, but I'm finding that I cannot resolve my jax-rs annotations -- what JAR (maven artifact) contains the needed jax-rs dependencies? Thanks, Brad On Apr 5, 2008, at 3:22 AM, Beryozkin, Sergey wrote: Hi Brad Yes, I can see you're using CXF HTTP Binding. I'd encourage you to try JAX-RS, not sure why it does not work in CXF HTTP Binding. With CXF JAX-RS you'd also have few options to plugin your custom serializers and deal with that namespace issue... Cheers, Sergey -----Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 05 April 2008 06:20 To: cxf-user@incubator.apache.org Subject: Re: Base class members not serializing / deserializing I thought I'd add some sample code: My superclass: @XmlType public abstract class ServiceRequest { private String ssid; @XmlAttribute public String getSsid() { return ssid; } public void setSsid(String ssid) { this.ssid = ssid; } } My impl class: @XmlRootElement //I have tried both @XmlType and nothing here, no luck public class ListServersRequest extends ServiceRequest { } My service method: @Post @HttpResource(location = "/listServers") @WebResult (name = "ListServersResponse") .ListServersResponse listServers(ListServersRequest request); It never reaches the method. I get the following error: INFO: Invoking POST on /listServers Apr 4, 2008 10:03:55 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/listServers] with content-type [application/xml] Apr 4, 2008 10:03:55 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org .apache .cxf .binding .http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:306) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .mergeParams(URIParameterInInterceptor.java: 122) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .handleMessage(URIParameterInInterceptor.java:103) at org .apache .cxf .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 208) at org .apache .cxf .transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) at org .apache .cxf .transport .servlet.ServletDestination.doMessage(ServletDestination.java:79) at org .apache .cxf .transport .servlet.ServletController.invokeDestination(ServletController.java: 264) at org .apache .cxf .transport.servlet.ServletController.invoke(ServletController.java: 123) 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:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache .catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 109) at org .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org .apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) If I rip the content from ServiceResponse and put it directly into ListServersResponse, everything works. Otherwise, everything fails. If anyone has any clue, I'd appreciate the help! Brad On Apr 4, 2008, at 6:47 PM, Brad O'Hearne wrote: Hello, I am using CXF with RESTful services, configured with Spring. My request objects (parameters to my service methods) and response objects (return types on my service methods) have a common stru
Re: Base class members not serializing / deserializing
I seem to have discovered a 2.1 SNAPSHOT jar -- is there a cxf-rt- frontend-jaxrs with the 2.0.5 release? B On Apr 5, 2008, at 3:38 PM, Brad O'Hearne wrote: Come to think of itI'm not seeing any cxf-rt-frontend-jaxrs on the incubating repository. Where can this dependency be found? None of my annotations will compile. B On Apr 5, 2008, at 3:29 PM, Brad O'Hearne wrote: Sergey, Thanks for the reply -- I've made my code changes, but I'm finding that I cannot resolve my jax-rs annotations -- what JAR (maven artifact) contains the needed jax-rs dependencies? Thanks, Brad On Apr 5, 2008, at 3:22 AM, Beryozkin, Sergey wrote: Hi Brad Yes, I can see you're using CXF HTTP Binding. I'd encourage you to try JAX-RS, not sure why it does not work in CXF HTTP Binding. With CXF JAX-RS you'd also have few options to plugin your custom serializers and deal with that namespace issue... Cheers, Sergey -Original Message- From: Brad O'Hearne [mailto:[EMAIL PROTECTED] Sent: 05 April 2008 06:20 To: cxf-user@incubator.apache.org Subject: Re: Base class members not serializing / deserializing I thought I'd add some sample code: My superclass: @XmlType public abstract class ServiceRequest { private String ssid; @XmlAttribute public String getSsid() { return ssid; } public void setSsid(String ssid) { this.ssid = ssid; } } My impl class: @XmlRootElement //I have tried both @XmlType and nothing here, no luck public class ListServersRequest extends ServiceRequest { } My service method: @Post @HttpResource(location = "/listServers") @WebResult (name = "ListServersResponse") .ListServersResponse listServers(ListServersRequest request); It never reaches the method. I get the following error: INFO: Invoking POST on /listServers Apr 4, 2008 10:03:55 PM org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor handleMessage INFO: URIParameterInterceptor handle message on path [/listServers] with content-type [application/xml] Apr 4, 2008 10:03:55 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now java.lang.NullPointerException at org .apache .cxf .binding .http.IriDecoderHelper.interopolateParams(IriDecoderHelper.java:306) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .mergeParams(URIParameterInInterceptor.java: 122) at org .apache .cxf .binding .http .interceptor .URIParameterInInterceptor .handleMessage(URIParameterInInterceptor.java:103) at org .apache .cxf .phase .PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208) at org .apache .cxf .transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77) at org .apache .cxf .transport .servlet.ServletDestination.doMessage(ServletDestination.java:79) at org .apache .cxf .transport .servlet .ServletController.invokeDestination(ServletController.java:264) at org .apache .cxf .transport.servlet.ServletController.invoke(ServletController.java: 123) 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:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain .internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 206) at org .apache .catalina .core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina .core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache .catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java: 109) at org .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org .apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) If I rip the content from ServiceResponse and put it directly into ListServersResponse, everything works. Otherwise, everything fails. If anyone has any clue, I'd appreciate the help! Brad On Apr 4, 2008, at 6:47 PM, Brad O'Hearne wrote: Hello, I am using CXF wit
Re: Base class members not serializing / deserializing
I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't compile. Is there another dependency needed? Brad On Apr 5, 2008, at 4:03 PM, Ian Roberts wrote: Brad O'Hearne wrote: I seem to have discovered a 2.1 SNAPSHOT jar -- is there a cxf-rt- frontend-jaxrs with the 2.0.5 release? No, 2.1 only I'm afraid. Ian -- Ian Roberts | Department of Computer Science [EMAIL PROTECTED] | University of Sheffield, UK
Re: Base class members not serializing / deserializing
Well, jax-rs seems to be a black art. I'll consider using it with CXF when I can get more information on how to configure the dependencies. On a lark, I grabbed the javax.ws.rs:jsr311-api 0.6 jar from Sun, and that didn't help -- annotations still don't compile. So back to my original question: If someone could lend *any* assistance with either showing me how to get inheritance to work with service parameters / return types using CXF/REST, or if it isn't possible, just inform me of that, I would greatly appreciate it. Thanks, Brad On Apr 5, 2008, at 4:07 PM, Brad O'Hearne wrote: I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't compile. Is there another dependency needed? Brad On Apr 5, 2008, at 4:03 PM, Ian Roberts wrote: Brad O'Hearne wrote: I seem to have discovered a 2.1 SNAPSHOT jar -- is there a cxf-rt- frontend-jaxrs with the 2.0.5 release? No, 2.1 only I'm afraid. Ian -- Ian Roberts | Department of Computer Science [EMAIL PROTECTED] | University of Sheffield, UK
Re: Base class members not serializing / deserializing
Doug, Thanks for the reply. Couple things -- first, @UriParam is now apparently @PathParam. Additionally, I cannot get the paths to work. I repeatedly get Tomcat errors that there's "No operation matching request path...", and others like itstill a black artI'd love to get this worked out, as I've got jax-rs loaded, I just need to be able to hit it now. I've tried about every URL combination possibleno dice. Prior to your post, I had reverted back to my Jax-WS frontend, and I discovered that inheritance IS working on serialization (outbound serialization on return types) but is NOT working on deserialization (inbound deserialization of XML to Java types on parameters). The problem is definitely there. Brad On Apr 5, 2008, at 7:54 PM, Doug wrote: On Sun, 6 Apr 2008, Brad O'Hearne wrote: I've moved to 2.1 SNAPSHOT -- my @UriTemplate annotations still won't compile. Is there another dependency needed? I think @UriTemplate was deprecated/replaced by @Path by the JSR-311 folks, but their spec documents aren't uptodate (thats my understanding anyway) Something like the following works for me (from the 2.1 SNAPSHOT): import javax.ws.rs.Path; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.core.HttpContext; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ProduceMime; import javax.ws.rs.ConsumeMime; import javax.ws.rs.UriParam; import javax.ws.rs.WebApplicationException; @Path("/rc") public class ReflectionCoverageService { @POST @Path("init/{clientId}") @ProduceMime("text/plain") public String init(@UriParam("clientId") String id, @HttpContext UriInfo info, SomeJavaBeanClass sjbc) { MultivaluedMap params = info.getQueryParameters();
jax-rs URLs not working (was: Base class members not serializing / deserializing)
Doug, Thanks for the reply. I'm still getting the same errors, going to show you exactly what happens in my implementation. Here is my web.xml: http://java.sun.com/dtd/web-app_2_3.dtd";> contextConfigLocation WEB-INF/beans.xml org.springframework.web.context.ContextLoaderListener CXFServlet CXF Servlet org.apache.cxf.transport.servlet.CXFServlet 1 CXFServlet /services/* Here is my beans.xml: http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:jaxrs="http://cxf.apache.org/jaxrs"; xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd";> Here is my service interface (which is implemented by the UserService class referenced in beans.xml): @Path("/UserService") public interface IUserService { @POST @Path("authenticate") @ConsumeMime("application/xml") @ProduceMime("application/xml") AuthenticateResponse authenticate(AuthenticateRequest request); } Tomcat loads cleanly (as far as I can tell -- no exceptions). When I try to access this service with an xml payload and the following URL: http://localhost:8080/MyWebApp/services/UserService/authenticate I get the following exception on the server: Apr 6, 2008 7:38:46 AM org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage SEVERE: No operation found for path: /UserService/authenticate/, contentType: application/xml, Accept contentType: */* Apr 6, 2008 7:38:46 AM org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: .No operation matching request path / UserService/authenticate/ is found, ContentType : application/xml, Accept : */*. at org .apache .cxf .jaxrs .interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java: 120) at org .apache .cxf .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org .apache .cxf .transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) at org .apache .cxf .transport.servlet.ServletDestination.invoke(ServletDestination.java:92) at org .apache .cxf .transport .servlet.ServletController.invokeDestination(ServletController.java:214) at org .apache .cxf.transport.servlet.ServletController.invoke(ServletController.java: 113) 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:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) I don't know what the deal is. Any help you can lend would be greatly appreciated. Thanks. Brad On Apr 6, 2008, at 4:49 AM, Doug wrote: On Sun, 6 Apr 2008, Brad O'Hearne wrote: Thanks for the reply. Couple things -- first, @UriParam is now apparently @PathParam. Additionally, I cannot get the paths to work. I repeatedly get Tomcat errors that there's "No operation matching request path...", and others like itstill a black artI'd love to get this worked out, as I've got jax-rs loaded, I just ne
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
ttpServlet.service(HttpServlet.java:803) at org .apache .catalina .core .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 290) at org .apache .catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org .apache .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 233) at org .apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org .apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java: 128) at org .apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java: 102) at org .apache .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java: 286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 844) at org.apache.coyote.http11.Http11Protocol $Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java: 447) at java.lang.Thread.run(Unknown Source) Can anyone give me that last push over the cliff here? I think I'm on the verge of getting around the problem Thanks, Brad On Apr 7, 2008, at 1:59 AM, Sergey Beryozkin wrote: Hi As far as I know annotations at the interface level will only supported in the 0.7 version (it's mandated in the corresponding version of the spec), and only method-level annotations will be inherited (I'll need to confirm it), Jersey does it on the current trunk (which is corresponds to the soon to be released stable 0.7 jaxrs-api). Brad, try to put the annotations on the actual root resource class, just to see that's working. Then at a later stage you may want to put the annotations on the superclass, but first try from the root resource class... Cheers, Sergey > Maybe the annotations have to go in the implementation class > instead/as well? I didn't use an "interface" - just an instantiatable > class (with method bodies). > > Apart from broken POST data, thats the only other thing I can think of. > > Doug > > > On Mon, 7 Apr 2008, Brad O'Hearne wrote: >> Doug, >> >> Thanks for the reply. I'm still getting the same errors, going to show >> you exactly what happens in my implementation. Here is my web.xml: >> >> >> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3// EN" >> "http://java.sun.com/dtd/web-app_2_3.dtd";> >> >> >> contextConfigLocation >> WEB-INF/beans.xml >> >> >> >> org.springframework.web.context.ContextLoaderListener >> >> >> >> CXFServlet >> CXF Servlet >> >> org.apache.cxf.transport.servlet.CXFServlet >> >> 1 >> >> >> CXFServlet >> /services/* >> >> >> >> Here is my beans.xml: >> >> >> http://www.springframework.org/schema/beans"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xmlns:jaxrs="http://cxf.apache.org/jaxrs"; >> xsi:schemaLocation=" >> http://www.springframework.org/schema/beans >> http://www.springframework.org/schema/beans/spring-beans.xsd >> http://cxf.apache.org/jaxrs >> http://cxf.apache.org/schemas/jaxrs.xsd";> >> >> >> resource="classpath:META-INF/cxf/cxf-extension-jaxrs- binding.xml" /> >> >> >> >> > class="com.brad.UserService" /> >> >> >> >> >> Here is my service interface (which is implemented by the UserService >> class referenced in beans.xml): >> >> @Path("/UserService") >> public interface IUserService { >> @POST >> @Path("authenticate") >> @ConsumeMime("application/xml") >> @ProduceMime("application/xml") >> AuthenticateResponse authenticate(AuthenticateRequest request); >> } >> >> Tomcat loads cleanly (as far as I can tell -- no exceptions). When I >> try to access this service with an xml payload and the following URL: >> http://localhost:8080/MyWebApp/services/UserService/authenticate >> >> I get the following exception on the server: >> >> Apr 6, 2008 7:38:46 AM >> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor handleMessage >> SEVERE: No operation found for path: /UserService/authenticate/, >> contentType: application/xml, Accept contentType: */* >> Apr 6, 2008 7:38:46 AM org.apache.cxf.phase.PhaseInterceptorChain >> doIntercept >> INFO: Interceptor has thrown exception, unwinding n
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Never mind on this.got it all worked out now. THANK YOU big time to the gents copied (and Daniel) for your advice. It would be great to get some of this stuff in a doc somewhere. Here was my winning formula: - Java 1.6.x - CXF 2.1-incubator-snapshot - Do not annotate interfaces, but implementation classes only. - Jax-RS (0.6 for the api) - annotate all parameter and return types with explicit @XmlType, @XmlRootElement, and explicit namespaces Everything appears to be working now. I still have some enums to get straight, but it looks like I'm out of the woods. Thanks again for your help guys. Brad On Apr 7, 2008, at 12:07 PM, Brad O'Hearne wrote: Sergey, It appears that putting the annotations on the implementation class (rather than the interface) resolved the path issues. You are right, apparently interface annotations are not supported. I really hope that these are supported in the future. However, I am still not out of the woods. The deserialization of parameters still is not working, and I am using the same XML payload that worked using jaxws. It seems to be choking on the default namespace in my XML. Here's the method getting called: @POST @Path("authenticate") @ConsumeMime("application/xml") @ProduceMime("application/xml") public AuthenticateResponse authenticate(AuthenticateRequest request) { and here's the XML being sent on the HTTP request: http://www.w3.org/2001/XMLSchema-instance " xmlns:xsd="http://www.w3.org/2001/XMLSchema"; password="password" uid="username" xmlns="http://us.service.securenow.whitenoise.com/"; /> Two things are happening. First, an exception gets thrown (which is shown below), and second, I do hit a breakpoint inside my authenticate method, but the request parameter is null. Here's the exception in the Tomcat logs: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://us.service.securenow.whitenoise.com/ ", local:"AuthenticateRequest"). Expected elements are <{}AuthenticateRequest> at com .sun .xml .bind .v2 .runtime .unmarshaller .UnmarshallingContext.handleEvent(UnmarshallingContext.java:603) at com .sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java: 244) at com .sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java: 239) at com .sun .xml .bind .v2 .runtime .unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext $DefaultRootLoader.childElement(UnmarshallingContext.java:1009) at com .sun .xml .bind .v2 .runtime .unmarshaller .UnmarshallingContext._startElement(UnmarshallingContext.java:446) at com .sun .xml .bind .v2 .runtime .unmarshaller .UnmarshallingContext.startElement(UnmarshallingContext.java:427) at com .sun .xml .bind .v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java: 137) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org .apache .xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org .apache .xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl $NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl $FragmentContentDispatcher.dispatch(Unknown Source) at org .apache .xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at com .sun .xml .bind .v2 .runtime .unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211) at com .sun .xml .bind .v2 .runtime .unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:184) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source) at org .apache .cxf .jaxrs .provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:62) at org.apache.cxf.jaxrs.JAXRSUtils.readFromMessageBody(JAXRSUtils.java: 495) at org.apache.cxf.jaxrs.JAXRSUtils.processParameter(JAXRSUtils.java: 312) at org.apache.cxf.jaxrs.JAXRSUtils.processParameters(JAXRSUtils.java:287) at org .apache .cxf .jaxrs .interceptor .JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:133) at org .apache .cxf .phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java: 220)