cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jervis Liu <jervis....@iona.com>
Subject RE: Parameters in Restful services
Date Sun, 21 Oct 2007 07:20:16 GMT

A couple of problems with this config file. Firstly, you need to use HTTP
binding for your REST service (instead of SOAP binding, which is the default
binding if you don't specify). See a standard bean.xml for RESTful services:
http://cwiki.apache.org/CXF20DOC/http-binding.html. Secondly, I am not 100%
sure that Aegis binding works with HTTP binding.  At least this is not
tested. If you still run into problems after using HTTP binding, try to
remove Aegis stuff to see if it helps.

Cheers,
Jervis

Tolan, Michael E wrote:
> 
> Jervis,
> 
> Thanks for getting back to me. I've tried it in wrapped an unwrapped
> modes, and am currently using a service factory defined as follows in a
> beans.xml file:
> 
> 	<bean id="aegisBean1"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding"/> 
> 	<bean id='jaxws-and-aegis-service-factory1'
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> 
> 	<property name="dataBinding" ref="aegisBean1"/>
> 	<property name="wrapped" value="false"/>
> 	 <property name="serviceConfigurations">
> 	     <list>
> 	       <bean
> class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
> 	       <bean
> class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
> 	       <bean
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
> 	    </list>
> 	</property>
> 	</bean>
> 
> Additionally, I came across some more log information that might be
> helpful or at least suggestive of what's going on here. 
> 
> The call I was making was /channelName/1.
> 
> -Mike
> 
> Oct 19, 2007 12:59:54 PM
> org.apache.cxf.interceptor.AttachmentInInterceptor handleMessage
> INFO: AttachmentInInterceptor skipped in HTTP GET method
> Oct 19, 2007 12:59:54 PM
> org.apache.cxf.binding.http.interceptor.DispatchInterceptor
> handleMessage
> INFO: Invoking GET on /channelName/1
> Oct 19, 2007 12:59:54 PM
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor
> handleMessage
> INFO: URIParameterInterceptor handle message on path [/channelName/1]
> with content-type [null]
> Oct 19, 2007 12:59:54 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> java.lang.NullPointerException
>         at
> org.apache.cxf.binding.http.IriDecoderHelper.buildDocument(IriDecoderHel
> per.java:222)
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeP
> arams(URIParameterInInterceptor.java:129)
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handle
> Message(URIParameterInInterceptor.java:105)
>         at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
> hain.java:207)
>         at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiati
> onObserver.java:73)
>         at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDes
> tination.java:78)
>         at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(Ser
> vletController.java:231)
>         at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletControl
> ler.java:105)
>         at
> org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:271)
>         at
> org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:253)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:290)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:206)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:233)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.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:2
> 63)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> 4)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
> Http11Protocol.java:584)
>         at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>         at java.lang.Thread.run(Thread.java:595)
> 
> 
> 
> -----Original Message-----
> From: Jervis Liu [mailto:jervis.liu@iona.com] 
> Sent: Thursday, October 18, 2007 9:20 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: Parameters in Restful services
> 
> 
> Hi Make sure you have the annotation right. I.e., it needs to be sth
> like
> below:
> 
> @Get
> @HttpResource(location="/channelName/{id}")
> public String getChannelName(@WebParam(name = "GetBook") GetChannel
> getChannel);
> 
> If this still does not work, try to play with wrapped and unwrapped
> style.
> eg, 
>         sf.getServiceFactory().setWrapped(false);
> 
> Let me know how you are getting on. 
> 
> Cheers,
> Jervis
> 
> 
> Tolan, Michael E wrote:
>> 
>> I'm having trouble with parameters in a RESTful service. 
>> 
>> After going over the User's guide, I think I understand that the {}
>> element in a HttpResource annotation should name a bean property on
> the
>> object argument to the implementation function. However, when I try to
>> set this up, it doesn't seem that the bean is ever initialized
>> correctly.
>> 
>>  
>> 
>> I suspect I'm doing something wrong, and would appreciate it if
> someone
>> could point me at what that might be.
>> 
>> In case it's relevant, I'm using the 2.0.2 version of cxf.
>> 
>>  
>> 
>> -Mike
>> 
>>  
>> 
>>  
>> 
>> SEI:
>> 
>> ------------------------------
>> 
>> import org.codehaus.jra.Get;
>> 
>> import org.codehaus.jra.HttpResource;
>> 
>>  
>> 
>> @Get
>> 
>> @HttpResource(location="/channelName/{id}")
>> 
>> public String getChannelName(GetChannel getChannel);
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> GetChannel.java:
>> 
>> ------------------------------
>> 
>> public class GetChannel {
>> 
>>                 private String id;
>> 
>>                 public GetChannel() {}
>> 
>>                 public String getId() {return id;}
>> 
>>                 public void setId(String id) {this.id = id;}
>> 
>> }
>> 
>>  
>> 
>>  
>> 
>> Implementaiton:
>> 
>> -------------------------------
>> 
>> public String getChannelName(GetChannel getChannel) {
>> 
>>                 Logger log = Logger.getLogger(BoardServiceImpl.class);
>> 
>>                 log.debug("getChannelName: "+getChannel); //getChannel
>> is null
>> 
>> }
>> 
>>  
>> 
>>  
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Parameters-in-Restful-services-tf4641537.html#a132
> 86805
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Parameters-in-Restful-services-tf4641537.html#a13326661
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message