cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <...@envoisolutions.com>
Subject Re: Trouble with creating RESTful Service deployed to Jetty - need help!
Date Thu, 12 Jul 2007 19:32:48 GMT
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 <jasbo1@hotmail.com> 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
> org.springframework.web.context.support.XmlWebApplicationContext@20bb:
> 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
> [org.springframework.web.context.support.XmlWebApplicationContext@20bb]:
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@bb5e2d
> 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
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@bb5e2d
> :
> 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 org.apache.cxf.bus.spring.BusApplicationContext@282b42:
> display name [org.apache.cxf.bus.spring.BusApplicationContext@282b42];
> startup date [Thu Jul 12 12:31:21 EDT 2007]; parent:
> org.springframework.web.context.support.XmlWebApplicationContext@20bb
> 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
> [org.apache.cxf.bus.spring.BusApplicationContext@282b42]:
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@3206c3
> Jul 12, 2007 12:31:21 PM
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> preInstantiateSingletons
> INFO: Pre-instantiating singletons in
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@3206c3
> :
> defining beans []; parent:
>
> org.springframework.beans.factory.support.DefaultListableBeanFactory@bb5e2d
> 2007-07-12 12:31:21.343::INFO:  Started SelectChannelConnector@0.0.0.0
> :8080
> [INFO] Started Jetty Server
>
>
> >From: "Dan Diephouse" <dan@envoisolutions.com>
> >Reply-To: cxf-user@incubator.apache.org
> >To: cxf-user@incubator.apache.org
> >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 <jasbo1@hotmail.com> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message