Bizarre... If you had a moment, I improved that line of code post 2.0 and
included some better error reporting. Any chance you'd be willing to try out
a snapshot quick and let us know if it works correctly?
http://incubator.apache.org/cxf/download.html

Otherwise I'll take a stab at figuring out whats going on soon.
Thanks,
-Dan

On 7/12/07, Jason Mihalick <[EMAIL PROTECTED]> wrote:

LOL, know just what you mean.  ;-)

Actually, while I was tinkering with it here I figured that out too.  I
realized that my URL should have had clients (plural) in it instead of
client (singular).  After I corrected that, I started getting a
NullPointerException:

INFO: URIParameterInterceptor handle message on path [/clients] with
content-type [null]
Jul 12, 2007 3:35:06 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(
IriDecoderHelper.java:213)
        at

org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams
(URIParameterInInterceptor.java:129)
        at

org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage
(URIParameterInInterceptor.java:105)


But wait ... there's more.  I decided to drop kick my service for the
moment
and pull in your CustomerService example from
apache-cxf-2.0-incubator/samples/restful_http_binding.  After I got all of
the configuration set up for that sample service, doing a get against this
URL worked:

http://localhost:8080/iat-services/ws/customer/customers

Hmmm.  Something screwy here.  So, I started comparing my webservice to
yours piece by piece and my NullPointerException went away when I added a
targetNamespace to my @WebService tag in my ClientService interface:

@WebService(targetNamespace = "http://iat.jcol.com";)

Adding that made the NPE go away, and now it's working!  Does this make
any
sense?  Why would that fix it, I wonder, hmmmm.  I've checked it a couple
of
times and adding/removing that namespace causes the NPE to
disappear/reappear.

Hope this helps in your understanding.  Let me know if there is any other
info I can provide to you.  Appreciate the help.
--
Jason


>From: "Dan Diephouse" <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: Trouble with creating RESTful Service deployed to Jetty -
need
>help!
>Date: Thu, 12 Jul 2007 13:32:48 -0600
>
>Wow, I think I'm losing it - I forgot how my code works. It turns out (as
>the logs suggest) that the correct URL is:
>
>http://localhost:8080/iat-services/ws/clients/10<
http://localhost:8080/iat-services/ws/client/10>
>
>(clientS not client)
>
>Cheers,
>- Dan
>
>On 7/12/07, Jason Mihalick <[EMAIL PROTECTED]> wrote:
>>
>>I just realized that I missed this in my output previously.  The Mapping
>>messages you mentioned are below.
>>
>>[INFO] Starting jetty 6.1H.4-beta ...
>>2007-07-12 12:31:19.634::INFO:  jetty-6.1H.4-beta
>>2007-07-12 12:31:19.840::INFO:  No Transaction manager found - if your
>>webapp requires one, please configure one.
>>2007-07-12 12:31:19.968:/iat-services:INFO:  Initializing Spring root
>>WebApplicationContext
>>Jul 12, 2007 12:31:19 PM org.springframework.web.context.ContextLoader
>>initWebApplicationContext
>>INFO: Root WebApplicationContext: initialization started
>>Jul 12, 2007 12:31:19 PM
>>org.springframework.context.support.AbstractApplicationContext refresh
>>INFO: Refreshing
>>[EMAIL PROTECTED]:
>>display name [Root WebApplicationContext]; startup date [Thu Jul 12
>>12:31:19
>>EDT 2007]; root of context hierarchy
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>>loadBeanDefinitions
>>INFO: Loading XML bean definitions from ServletContext resource
>>[/WEB-INF/beans.xml]
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>>loadBeanDefinitions
>>INFO: Loading XML bean definitions from class path resource
>>[META-INF/cxf/cxf.xml]
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>>loadBeanDefinitions
>>INFO: Loading XML bean definitions from class path resource
>>[META-INF/cxf/cxf-extension-soap.xml]
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>>loadBeanDefinitions
>>INFO: Loading XML bean definitions from class path resource
>>[META-INF/cxf/cxf-servlet.xml]
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>>loadBeanDefinitions
>>INFO: Loading XML bean definitions from class path resource
>>[META-INF/cxf/cxf-extension-http-binding.xml]
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.context.support.AbstractApplicationContext refresh
>>INFO: Bean factory for application context
>>[EMAIL PROTECTED]:
>>
>>
[EMAIL PROTECTED]
>>Jul 12, 2007 12:31:20 PM
>>
>>
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
>>postProcessAfterInitialization
>>INFO: Bean 'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' is not
>>eligible for getting processed by all BeanPostProcessors (for example:
not
>>eligible for auto-proxying)
>>Jul 12, 2007 12:31:20 PM
>>
>>
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
>>postProcessAfterInitialization
>>INFO: Bean 'cxf' is not eligible for getting processed by all
>>BeanPostProcessors (for example: not eligible for auto-proxying)
>>Jul 12, 2007 12:31:20 PM
>>
>>
org.springframework.context.support.AbstractApplicationContext$BeanPostProcessorChecker
>>postProcessAfterInitialization
>>INFO: Bean 'org.apache.cxf.bus.spring.BusExtensionPostProcessor' is not
>>eligible for getting processed by all BeanPostProcessors (for example:
not
>>eligible for auto-proxying)
>>Jul 12, 2007 12:31:20 PM
>>org.springframework.beans.factory.support.DefaultListableBeanFactory
>>preInstantiateSingletons
>>INFO: Pre-instantiating singletons in
>>
>>
[EMAIL PROTECTED]
>>:
>>defining beans
>>[cxf,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,
>>org.apache.cxf.bus.spring.BusExtensionPostProcessor,
>>org.apache.cxf.resource.ResourceManager,
>>org.apache.cxf.binding.BindingFactoryManager,
>>org.apache.cxf.transport.DestinationFactoryManager,
>>org.apache.cxf.transport.ConduitInitiatorManager,
>>org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,
>>org.apache.cxf.workqueue.WorkQueueManager,
>>org.apache.cxf.buslifecycle.BusLifeCycleManager,
>>org.apache.cxf.endpoint.ServerRegistry,
>>org.apache.cxf.endpoint.ServerLifeCycleManager,
>>org.apache.cxf.endpoint.ClientLifeCycleManager,
>>org.apache.cxf.transports.http.QueryHandlerRegistry,
>>org.apache.cxf.endpoint.EndpointResolverRegistry,
>>org.apache.cxf.headers.HeaderManager,
>>org.apache.cxf.catalog.OASISCatalogManager,
>>org.apache.cxf.binding.soap.SoapBindingFactory,
>>org.apache.cxf.binding.soap.SoapTransportFactory,
>>org.apache.cxf.binding.soap.customEditorCo
>>nfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,
>>org.apache.cxf.binding.http.HttpBindingFactory
>>,JaxWsServiceFactoryBean,restfulServer];
>>root of factory hierarchy
>>Jul 12, 2007 12:31:20 PM
>>org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>buildServiceFromClass
>>INFO: Creating Service
>>{http://services.iat.jcol.com/}ClientServiceImplService from class
>>com.jcol.iat.services.ClientServiceImpl
>>Jul 12, 2007 12:31:21 PM
>>org.apache.cxf.binding.http.strategy.ConventionStrategy map
>>INFO: Mapping method updateClient to resource /clients and verb PUT
>>Jul 12, 2007 12:31:21 PM
>>org.apache.cxf.binding.http.strategy.ConventionStrategy map
>>INFO: Mapping method getClient to resource /clients and verb GET
>>Jul 12, 2007 12:31:21 PM
>>org.apache.cxf.binding.http.strategy.ConventionStrategy map
>>INFO: Mapping method deleteClient to resource /clients and verb DELETE
>>Jul 12, 2007 12:31:21 PM
>>org.apache.cxf.binding.http.strategy.ConventionStrategy map
>>INFO: Mapping method addClient to resource /clients and verb POST
>>Jul 12, 2007 12:31:21 PM
>>org.apache.cxf.binding.http.strategy.ConventionStrategy map
>>INFO: Mapping method getClients to resource /clients and verb GET
>>Jul 12, 2007 12:31:21 PM org.springframework.web.context.ContextLoader
>>initWebApplicationContext
>>INFO: Root WebApplicationContext: initialization completed in 1383 ms
>>Jul 12, 2007 12:31:21 PM
>>org.springframework.context.support.AbstractApplicationContext refresh
>>INFO: Refreshing [EMAIL PROTECTED]:
>>display name [EMAIL PROTECTED];
>>startup date [Thu Jul 12 12:31:21 EDT 2007]; parent:
>>[EMAIL PROTECTED]
>>Jul 12, 2007 12:31:21 PM org.apache.cxf.bus.spring.BusApplicationContext
>>getConfigResources
>>INFO: Could not find the configuration file cxf.xml on the classpath.
>>Jul 12, 2007 12:31:21 PM
>>org.springframework.context.support.AbstractApplicationContext refresh
>>INFO: Bean factory for application context
>>[EMAIL PROTECTED]:
>>
>>
[EMAIL PROTECTED]
>>Jul 12, 2007 12:31:21 PM
>>org.springframework.beans.factory.support.DefaultListableBeanFactory
>>preInstantiateSingletons
>>INFO: Pre-instantiating singletons in
>>
>>
[EMAIL PROTECTED]
>>:
>>defining beans []; parent:
>>
>>
[EMAIL PROTECTED]
>>2007-07-12 12:31:21.343::INFO:  Started [EMAIL PROTECTED]
>>:8080
>>[INFO] Started Jetty Server
>>
>>
>> >From: "Dan Diephouse" <[EMAIL PROTECTED]>
>> >Reply-To: [email protected]
>> >To: [email protected]
>> >Subject: Re: Trouble with creating RESTful Service deployed to Jetty -
>>need
>> >help!
>> >Date: Thu, 12 Jul 2007 10:56:08 -0600
>> >
>> >Hi Jason,
>> >
>> >Everything looks roughly correct. Can you paste the log output? You
>>should
>> >some output from this line of code:
>> >
>> >LOG.info("Mapping method " + name + " to resource " + resource + " and
>>verb
>> >" + verb);
>> >
>> >Which should help clarify whats going on...
>> >
>> >- Dan
>> >
>> >On 7/12/07, Jason Mihalick <[EMAIL PROTECTED]> wrote:
>> >>
>> >>Hello,
>> >>
>> >>For the life of me I can't seem to get a simple RESTful webservice to
>>work
>> >>when I deploy it to Jetty (I haven't tried any other containers).  I
>> >>assume
>> >>that I am correct in using the CFXServlet to handle requests and
route
>> >>them
>> >>to the service implementation?  iat-services is the name of my webapp
>> >>context.
>> >>
>> >>When I try to do a GET on this URL (just using a web browser):
>> >>http://localhost:8080/iat-services/ws/
>> >>
>> >>I get this output: {
http://services.iat.jcol.com/}ClientServiceImplPort
>> >>
>> >>That looks fine, I think.
>> >>
>> >>Now, when I try to invoke my "client" service, with this url:
>> >>http://localhost:8080/iat-services/ws/client/10
>> >>
>> >>I get this output: Invalid URL/Verb combination. Verb: GET Path: /10
>> >>
>> >>If I try: http://localhost:8080/iat-services/ws/client/client/10
>> >>
>> >>I get this output: Invalid URL/Verb combination. Verb: GET Path:
>> >>/client/10
>> >>
>> >>What am I doing wrong here?  My classes and config are below.  I can
>>post
>> >>a
>> >>stack trace if you think it will help.
>> >>
>> >>==================
>> >>Service interface:
>> >>==================
>> >>package com.jcol.iat.services;
>> >>
>> >>import java.util.Collection;
>> >>
>> >>import javax.jws.WebService;
>> >>
>> >>import org.codehaus.jra.Delete;
>> >>import org.codehaus.jra.Get;
>> >>import org.codehaus.jra.HttpResource;
>> >>import org.codehaus.jra.Post;
>> >>import org.codehaus.jra.Put;
>> >>
>> >>
>> >>@WebService
>> >>public interface ClientService {
>> >>
>> >>   public Collection<Client> getClients();
>> >>
>> >>   public Client getClient( long id );
>> >>   public void addClient( Client client );
>> >>
>> >>   public void updateClient( long id, Client client);
>> >>
>> >>   public void deleteClient( long id );
>> >>
>> >>}
>> >>
>> >>
>> >>=============
>> >>Service Impl:
>> >>=============
>> >>package com.jcol.iat.services;
>> >>
>> >>import java.util.ArrayList;
>> >>import java.util.Collection;
>> >>
>> >>import javax.jws.WebService;
>> >>
>> >>@WebService(endpointInterface = "com.jcol.iat.services.ClientService
")
>> >>public class ClientServiceImpl implements ClientService {
>> >>
>> >>   public ClientServiceImpl() {
>> >>
>> >>   }
>> >>
>> >>   public Collection<Client> getClients() {
>> >>     System.out.println( "getClients invoked" );
>> >>     return new ArrayList<Client>();
>> >>     // FIXME
>> >>   }
>> >>
>> >>   public Client getClient( long id ) {
>> >>     System.out.println( "getClient invoked" );
>> >>     // FIXME
>> >>     return new Client();
>> >>   }
>> >>
>> >>   public void addClient( Client client ) {
>> >>     System.out.println( "addClient invoked" );
>> >>     //FIXME
>> >>   }
>> >>
>> >>   public void updateClient( long id, Client client) {
>> >>     System.out.println( "updateClient invoked" );
>> >>     //FIXME
>> >>   }
>> >>
>> >>   public void deleteClient( long id ) {
>> >>     System.out.println( "deleteClient invoked" );
>> >>     //FIXME
>> >>   }
>> >>
>> >>}
>> >>
>> >>=========
>> >>beans.xml
>> >>=========
>> >><beans xmlns="http://www.springframework.org/schema/beans";
>> >>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>> >>              xmlns:jaxws="http://cxf.apache.org/jaxws";
>> >>        xsi:schemaLocation="
http://www.springframework.org/schema/beans
>> >>http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> >>                            http://cxf.apache.org/jaxws
>> >>file:///Applications/Java/toolkits/apache-cxf/apache-
>>cxf-2.0-incubator-src
>> >>/rt/frontend/jaxws/src/main/resources/schemas/jaxws.xsd"
>> >> >
>> >><!-- Fix the jaxws schemaLocation above -->
>> >>
>> >><!--
>> >>
>> >>              xsi:schemaLocation="
>> >>http://www.springframework.org/schema/beans
>> >>http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> >>                                  http://cxf.apache.org/jaxws
>> >>http://cxf.apache.org/schemas/jaxws.xsd";
>> >>
>> >>     -->
>> >>         <import resource="classpath:META-INF/cxf/cxf.xml" />
>> >>         <import
>>resource="classpath:META-INF/cxf/cxf-extension-soap.xml
>>"
>> >>/>
>> >>         <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>> >>         <import resource="classpath:META-INF/cxf/cxf-
>> >>extension-http-binding.xml" />
>> >>
>> >>   <bean id="JaxWsServiceFactoryBean"
>> >>class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>> >>     <property name="wrapped" value="false"/>
>> >>   </bean>
>> >>
>> >>   <jaxws:endpoint id="restfulServer"
>> >>               implementor="com.jcol.iat.services.ClientServiceImpl"
>> >>               address="/client"
>> >>               bindingUri="http://apache.org/cxf/binding/http";>
>> >>      <jaxws:serviceFactory>
>> >>          <ref bean="JaxWsServiceFactoryBean"/>
>> >>      </jaxws:serviceFactory>
>> >>   </jaxws:endpoint>
>> >></beans>
>> >>
>> >>=======
>> >>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>/ws/*</url-pattern>
>> >>         </servlet-mapping>
>> >></web-app>
>> >>
>> >>Thanks,
>> >>Jason
>> >>
>> >>
>> >>
>> >
>> >
>> >--
>> >Dan Diephouse
>> >Envoi Solutions
>> >http://envoisolutions.com | http://netzooid.com/blog
>>
>>
>>
>
>
>--
>Dan Diephouse
>Envoi Solutions
>http://envoisolutions.com | http://netzooid.com/blog





--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to