cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad O'Hearne <br...@neurofire.com>
Subject Re: Base class members not serializing / deserializing
Date Sat, 05 Apr 2008 22:54:09 GMT
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
>>
>


Mime
View raw message