You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Brad O'Hearne <br...@neurofire.com> on 2008/04/05 03:47:13 UTC
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: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Posted by Brad O'Hearne <br...@neurofire.com>.
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:
>
> <?xml version="1.0" encoding="utf-8"?>
> <AuthenticateRequest xmlns:xsi="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)
> 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)
>
> 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:
>> >>
>> >> <!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>WEB-INF/beans.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>
>> >> <load-on-startup>1</load-on-startup>
>> >> </servlet>
>> >> <servlet-mapping>
>> >> <servlet-name>CXFServlet</servlet-name>
>> >> <url-pattern>/services/*</url-pattern>
>> >> </servlet-mapping>
>> >> </web-app>
>> >>
>> >> Here is my beans.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: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">
>> >> <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> <import
>> >> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> binding.xml" />
>> >> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >> <jaxrs:server id="userService" address="/">
>> >> <jaxrs:serviceBeans>
>> >> <bean
>> >> class="com.brad.UserService" />
>> >> </jaxrs:serviceBeans>
>> >> </jaxrs:server>
>> >> </beans>
>> >>
>> >> 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 it....still a black
>> art....I'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
>> >> >> possible....no dice.
>> >> >
>> >> > @PathParam may well be the next JSR-311 incarnation, but at
>> least for
>> >> > apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation
>> that
>> >> > works,
>> >> > for me, is @Path.
>> >> >
>> >> > Specifically, using my previous example,
>> >> > I have a tomcat webapps project "reflncover" which I access by
>> the
>> >> > URL:
>> >> >
>> >> > http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=va
>> >> >l2
>> >> >
>> >> > The "svc" component of the URL originates from the WEB-INF/
>> web.xml
>> >> > file:
>> >> >
>> >> > <servlet-mapping>
>> >> > <servlet-name>CXFServlet</servlet-name>
>> >> > <url-pattern>/svc/*</url-pattern>
>> >> > </servlet-mapping>
>> >> >
>> >> > Also, in my beans.xml file (referenced by web.xml) I have:
>> >> >
>> >> > <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> >> > binding.xml" />
>> >> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >> > <jaxrs:server id="reflectionCoverage" address="/">
>> >> > <jaxrs:serviceBeans>
>> >> > <bean
>> >> > class="au.net.mmsn.rc.services.ReflectionCoverageService" />
>> >> > </jaxrs:serviceBeans>
>> >> > </jaxrs:server>
>> >> >
>> >> > It works for me.
>> >> >
>> >> > Originally I had a bit of trouble figuring the format of the
>> XML to
>> >> > POST
>> >> > to my /init/ REST service, so I ended up creating a dummy @GET
>> service
>> >> > URL that returned a dummy bean class (as XML) that I created and
>> >> > populated within my ReflectionCovergeService class (below).
>> Once I had
>> >> > that then submitting the same XML structure back "just worked".
>> >> >
>> >> > Hope this helps.
>> >> > Doug
>> >> >
>> >> >> 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.
>> >> >
>> >> > Not sure what you mean by "inheritance" here. I looked briefly
>> at
>> >> > JAX-WS
>> >> > but wrapping everything in SOAP headers wasn't flexible enough
>> for my
>> >> > needs.
>> >> >
>> >> > Hope this helps
>> >> > Doug
>> >> >
>> >> >> 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();
>> >
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
>> Ireland
>
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Posted by Brad O'Hearne <br...@neurofire.com>.
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:
<?xml version="1.0" encoding="utf-8"?>
<AuthenticateRequest xmlns:xsi="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)
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)
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:
> >>
> >> <!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>WEB-INF/beans.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>
> >> <load-on-startup>1</load-on-startup>
> >> </servlet>
> >> <servlet-mapping>
> >> <servlet-name>CXFServlet</servlet-name>
> >> <url-pattern>/services/*</url-pattern>
> >> </servlet-mapping>
> >> </web-app>
> >>
> >> Here is my beans.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: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">
> >> <import resource="classpath:META-INF/cxf/cxf.xml" />
> >> <import
> >> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml" />
> >> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >> <jaxrs:server id="userService" address="/">
> >> <jaxrs:serviceBeans>
> >> <bean
> >> class="com.brad.UserService" />
> >> </jaxrs:serviceBeans>
> >> </jaxrs:server>
> >> </beans>
> >>
> >> 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 it....still a black
> art....I'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
> >> >> possible....no dice.
> >> >
> >> > @PathParam may well be the next JSR-311 incarnation, but at
> least for
> >> > apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation
> that
> >> > works,
> >> > for me, is @Path.
> >> >
> >> > Specifically, using my previous example,
> >> > I have a tomcat webapps project "reflncover" which I access by
> the
> >> > URL:
> >> >
> >> > http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=va
> >> >l2
> >> >
> >> > The "svc" component of the URL originates from the WEB-INF/
> web.xml
> >> > file:
> >> >
> >> > <servlet-mapping>
> >> > <servlet-name>CXFServlet</servlet-name>
> >> > <url-pattern>/svc/*</url-pattern>
> >> > </servlet-mapping>
> >> >
> >> > Also, in my beans.xml file (referenced by web.xml) I have:
> >> >
> >> > <import resource="classpath:META-INF/cxf/cxf.xml" />
> >> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> >> > binding.xml" />
> >> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> >> > <jaxrs:server id="reflectionCoverage" address="/">
> >> > <jaxrs:serviceBeans>
> >> > <bean
> >> > class="au.net.mmsn.rc.services.ReflectionCoverageService" />
> >> > </jaxrs:serviceBeans>
> >> > </jaxrs:server>
> >> >
> >> > It works for me.
> >> >
> >> > Originally I had a bit of trouble figuring the format of the
> XML to
> >> > POST
> >> > to my /init/ REST service, so I ended up creating a dummy @GET
> service
> >> > URL that returned a dummy bean class (as XML) that I created and
> >> > populated within my ReflectionCovergeService class (below).
> Once I had
> >> > that then submitting the same XML structure back "just worked".
> >> >
> >> > Hope this helps.
> >> > Doug
> >> >
> >> >> 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.
> >> >
> >> > Not sure what you mean by "inheritance" here. I looked briefly at
> >> > JAX-WS
> >> > but wrapping everything in SOAP headers wasn't flexible enough
> for my
> >> > needs.
> >> >
> >> > Hope this helps
> >> > Doug
> >> >
> >> >> 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();
> >
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Posted by Sergey Beryozkin <se...@iona.com>.
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:
>>
>> <!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>WEB-INF/beans.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>
>> <load-on-startup>1</load-on-startup>
>> </servlet>
>> <servlet-mapping>
>> <servlet-name>CXFServlet</servlet-name>
>> <url-pattern>/services/*</url-pattern>
>> </servlet-mapping>
>> </web-app>
>>
>> Here is my beans.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: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">
>> <import resource="classpath:META-INF/cxf/cxf.xml" />
>> <import
>> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> <jaxrs:server id="userService" address="/">
>> <jaxrs:serviceBeans>
>> <bean
>> class="com.brad.UserService" />
>> </jaxrs:serviceBeans>
>> </jaxrs:server>
>> </beans>
>>
>> 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 it....still a black art....I'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
>> >> possible....no dice.
>> >
>> > @PathParam may well be the next JSR-311 incarnation, but at least for
>> > apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that
>> > works,
>> > for me, is @Path.
>> >
>> > Specifically, using my previous example,
>> > I have a tomcat webapps project "reflncover" which I access by the
>> > URL:
>> >
>> > http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=va
>> >l2
>> >
>> > The "svc" component of the URL originates from the WEB-INF/web.xml
>> > file:
>> >
>> > <servlet-mapping>
>> > <servlet-name>CXFServlet</servlet-name>
>> > <url-pattern>/svc/*</url-pattern>
>> > </servlet-mapping>
>> >
>> > Also, in my beans.xml file (referenced by web.xml) I have:
>> >
>> > <import resource="classpath:META-INF/cxf/cxf.xml" />
>> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
>> > binding.xml" />
>> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> > <jaxrs:server id="reflectionCoverage" address="/">
>> > <jaxrs:serviceBeans>
>> > <bean
>> > class="au.net.mmsn.rc.services.ReflectionCoverageService" />
>> > </jaxrs:serviceBeans>
>> > </jaxrs:server>
>> >
>> > It works for me.
>> >
>> > Originally I had a bit of trouble figuring the format of the XML to
>> > POST
>> > to my /init/ REST service, so I ended up creating a dummy @GET service
>> > URL that returned a dummy bean class (as XML) that I created and
>> > populated within my ReflectionCovergeService class (below). Once I had
>> > that then submitting the same XML structure back "just worked".
>> >
>> > Hope this helps.
>> > Doug
>> >
>> >> 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.
>> >
>> > Not sure what you mean by "inheritance" here. I looked briefly at
>> > JAX-WS
>> > but wrapping everything in SOAP headers wasn't flexible enough for my
>> > needs.
>> >
>> > Hope this helps
>> > Doug
>> >
>> >> 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();
>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: jax-rs URLs not working (was: Base class members not serializing / deserializing)
Posted by Doug <do...@gmail.com>.
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:
>
> <!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>WEB-INF/beans.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>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/services/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
> Here is my beans.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: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">
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import
> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> <jaxrs:server id="userService" address="/">
> <jaxrs:serviceBeans>
> <bean
> class="com.brad.UserService" />
> </jaxrs:serviceBeans>
> </jaxrs:server>
> </beans>
>
> 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 it....still a black art....I'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
> >> possible....no dice.
> >
> > @PathParam may well be the next JSR-311 incarnation, but at least for
> > apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that
> > works,
> > for me, is @Path.
> >
> > Specifically, using my previous example,
> > I have a tomcat webapps project "reflncover" which I access by the
> > URL:
> >
> > http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=va
> >l2
> >
> > The "svc" component of the URL originates from the WEB-INF/web.xml
> > file:
> >
> > <servlet-mapping>
> > <servlet-name>CXFServlet</servlet-name>
> > <url-pattern>/svc/*</url-pattern>
> > </servlet-mapping>
> >
> > Also, in my beans.xml file (referenced by web.xml) I have:
> >
> > <import resource="classpath:META-INF/cxf/cxf.xml" />
> > <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> > binding.xml" />
> > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> > <jaxrs:server id="reflectionCoverage" address="/">
> > <jaxrs:serviceBeans>
> > <bean
> > class="au.net.mmsn.rc.services.ReflectionCoverageService" />
> > </jaxrs:serviceBeans>
> > </jaxrs:server>
> >
> > It works for me.
> >
> > Originally I had a bit of trouble figuring the format of the XML to
> > POST
> > to my /init/ REST service, so I ended up creating a dummy @GET service
> > URL that returned a dummy bean class (as XML) that I created and
> > populated within my ReflectionCovergeService class (below). Once I had
> > that then submitting the same XML structure back "just worked".
> >
> > Hope this helps.
> > Doug
> >
> >> 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.
> >
> > Not sure what you mean by "inheritance" here. I looked briefly at
> > JAX-WS
> > but wrapping everything in SOAP headers wasn't flexible enough for my
> > needs.
> >
> > Hope this helps
> > Doug
> >
> >> 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)
Posted by Brad O'Hearne <br...@neurofire.com>.
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:
<!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>WEB-INF/beans.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>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
Here is my beans.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: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">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="userService" address="/">
<jaxrs:serviceBeans>
<bean
class="com.brad.UserService" />
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>
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 it....still a black art....I'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
>> possible....no dice.
>
> @PathParam may well be the next JSR-311 incarnation, but at least for
> apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that
> works,
> for me, is @Path.
>
> Specifically, using my previous example,
> I have a tomcat webapps project "reflncover" which I access by the
> URL:
>
> http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=val2
>
> The "svc" component of the URL originates from the WEB-INF/web.xml
> file:
>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/svc/*</url-pattern>
> </servlet-mapping>
>
> Also, in my beans.xml file (referenced by web.xml) I have:
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-
> binding.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> <jaxrs:server id="reflectionCoverage" address="/">
> <jaxrs:serviceBeans>
> <bean
> class="au.net.mmsn.rc.services.ReflectionCoverageService" />
> </jaxrs:serviceBeans>
> </jaxrs:server>
>
> It works for me.
>
> Originally I had a bit of trouble figuring the format of the XML to
> POST
> to my /init/ REST service, so I ended up creating a dummy @GET service
> URL that returned a dummy bean class (as XML) that I created and
> populated within my ReflectionCovergeService class (below). Once I had
> that then submitting the same XML structure back "just worked".
>
> Hope this helps.
> Doug
>
>
>> 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.
>
> Not sure what you mean by "inheritance" here. I looked briefly at
> JAX-WS
> but wrapping everything in SOAP headers wasn't flexible enough for my
> needs.
>
> Hope this helps
> Doug
>
>>
>> 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();
>
>
RE: Base class members not serializing / deserializing
Posted by "Beryozkin, Sergey" <Se...@iona.com>.
Hi
@Path replaces @UriTemplate and @PathParam replaces @UriParam,
I'm wondering why you have no compilation issues with jsr-311-api 0.6 if
use still can use @UriParam ? May be jsr-311-api 0.5 is also on a class
path ?
Cheers, Sergey
-----Original Message-----
From: Doug [mailto:doug.duboulay@gmail.com]
Sent: 06 April 2008 12:49
To: Brad O'Hearne
Cc: cxf-user@incubator.apache.org
Subject: Re: Base class members not serializing / deserializing
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 it....still a black art....I'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
> possible....no dice.
@PathParam may well be the next JSR-311 incarnation, but at least for
apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that
works,
for me, is @Path.
Specifically, using my previous example,
I have a tomcat webapps project "reflncover" which I access by the URL:
http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=v
al2
The "svc" component of the URL originates from the WEB-INF/web.xml file:
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/svc/*</url-pattern>
</servlet-mapping>
Also, in my beans.xml file (referenced by web.xml) I have:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="reflectionCoverage" address="/">
<jaxrs:serviceBeans>
<bean class="au.net.mmsn.rc.services.ReflectionCoverageService" />
</jaxrs:serviceBeans>
</jaxrs:server>
It works for me.
Originally I had a bit of trouble figuring the format of the XML to POST
to my /init/ REST service, so I ended up creating a dummy @GET service
URL that returned a dummy bean class (as XML) that I created and
populated within my ReflectionCovergeService class (below). Once I had
that then submitting the same XML structure back "just worked".
Hope this helps.
Doug
> 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.
Not sure what you mean by "inheritance" here. I looked briefly at JAX-WS
but wrapping everything in SOAP headers wasn't flexible enough for my
needs.
Hope this helps
Doug
>
> 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();
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Base class members not serializing / deserializing
Posted by Doug <do...@gmail.com>.
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 it....still a black art....I'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
> possible....no dice.
@PathParam may well be the next JSR-311 incarnation, but at least for
apache-cxf-2.1-incubator-20080306.021818-37.zip the annotation that works,
for me, is @Path.
Specifically, using my previous example,
I have a tomcat webapps project "reflncover" which I access by the URL:
http://localhost:8080/reflncover/svc/rc/init/myclientid?arg1=val1&arg2=val2
The "svc" component of the URL originates from the WEB-INF/web.xml file:
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/svc/*</url-pattern>
</servlet-mapping>
Also, in my beans.xml file (referenced by web.xml) I have:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="reflectionCoverage" address="/">
<jaxrs:serviceBeans>
<bean class="au.net.mmsn.rc.services.ReflectionCoverageService" />
</jaxrs:serviceBeans>
</jaxrs:server>
It works for me.
Originally I had a bit of trouble figuring the format of the XML to POST
to my /init/ REST service, so I ended up creating a dummy @GET service
URL that returned a dummy bean class (as XML) that I created and
populated within my ReflectionCovergeService class (below). Once I had
that then submitting the same XML structure back "just worked".
Hope this helps.
Doug
> 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.
Not sure what you mean by "inheritance" here. I looked briefly at JAX-WS
but wrapping everything in SOAP headers wasn't flexible enough for my
needs.
Hope this helps
Doug
>
> 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();
Re: Base class members not serializing / deserializing
Posted by Daniel Kulp <dk...@apache.org>.
Brad,
It's quite possible (and highly likely) that the JAXB context is not
being created with the subclasses as part of the context. Thus, the
subclasses cannot be properly written/read. By default, the runtime
just examines the exact classes referenced from the SEI interface to
figure out what classes need to be bound into the context. In many
cases, the subclasses would not be referenced there and thus would not
be found.
There are a couple ways to deal with it:
1) If using jaxws/jaxb plus the 2.1 snapshots, (this is a jaxws 2.1
feature) you can add @XmlSeeAlso annotations in various places to have
it "SeeAlso" the additional classes.
2) If the subclasses are in the same package as the base class, stick
a "jaxb.index" file in the package that just lists the sub-classes.
(without the package names)
3) There are spring config methods of adding extra classes to the
context. You can see our systest config:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml?revision=581341&view=markup
Dan
On Sunday 06 April 2008, Brad O'Hearne wrote:
> 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 it....still a black art....I'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
> possible....no 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();
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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 it....still a black art....I'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
possible....no 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();
>
>
>
Re: Base class members not serializing / deserializing
Posted by Doug <do...@gmail.com>.
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();
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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
>> i.roberts@dcs.shef.ac.uk | University of Sheffield, UK
>
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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
> i.roberts@dcs.shef.ac.uk | University of Sheffield, UK
Re: Base class members not serializing / deserializing
Posted by Ian Roberts <i....@dcs.shef.ac.uk>.
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
i.roberts@dcs.shef.ac.uk | University of Sheffield, UK
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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 it....I'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:brado@neurofire.com]
>>> 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 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
>>>
>>> ----------------------------
>>> IONA Technologies PLC (registered in Ireland)
>>> Registered Number: 171387
>>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
>>> Ireland
>>
>
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
Come to think of it....I'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:brado@neurofire.com]
>> 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 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
>>
>> ----------------------------
>> IONA Technologies PLC (registered in Ireland)
>> Registered Number: 171387
>> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
>> Ireland
>
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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:brado@neurofire.com]
> 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 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
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland
RE: Base class members not serializing / deserializing
Posted by "Beryozkin, Sergey" <Se...@iona.com>.
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:brado@neurofire.com]
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 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
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Base class members not serializing / deserializing
Posted by Brad O'Hearne <br...@neurofire.com>.
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