Re: Rest GET params coming in null...
Just a shot in the dark herecould setting wrapped to false help ? Mansour :-) On Aug 1, 2007, at 11:49 AM, Brad Harper wrote: I've debugged this down far enough to see that the GetModel object is being interpreted correctly, but the id param is never bound to this object. Any thoughts? On 7/31/07, Brad Harper [EMAIL PROTECTED] wrote: My get (all) requests (/services/rest/productTypes) are working. They return xml like this... ns1:getProductTypesResponse ProductTypes descriptionPaper/description id10/id /ProductTypes ProductTypes descriptionCanvas/description id11/id /ProductTypes /ns1:getProductTypesResponse My get individual requests (/services/rest/productTypes/1) are failing because the id property of the GetModel object is null. Any ideas? Code/config below config: bean id=RestServiceImpl class= com.gdservices.service.thirdparty.RestServiceImpl property name=daoFactory ref bean=hibernateDAOFactory/ /property /bean !-- REST -- jaxws:endpoint id=restRest implementor=#RestServiceImpl address=/rest bindingUri= http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class= org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=true / /bean /jaxws:serviceFactory /jaxws:endpoint Service: @WebService( targetNamespace = http:// restService.service.gdservices.com/ ) public interface RestService { @Get @HttpResource(location=/productTypes) @WebResult(name = ProductTypes) public ListTpMetaData getProductTypes() throws ServiceException; @Get @HttpResource(location=/productTypes/{id}) public TpMetaData getProductType(@WebParam(name = GetModel) GetModel getModel) throws ServiceException ; } Param Object: @XmlRootElement(name = GetModel) public class GetModel { private long id; public long getId() { return id; } public void setId(long id) { this.id = id; } } Mansour :-)
Re: Rest GET params coming in null...
BTW.there might be an issue with itI did try it using the restful_http_binding sample and no go. Raised a JIRA On Aug 1, 2007, at 2:01 PM, Brad Harper wrote: Is that done with an annotation? On 8/1/07, Mansour Raad [EMAIL PROTECTED] wrote: Just a shot in the dark herecould setting wrapped to false help ? Mansour :-) On Aug 1, 2007, at 11:49 AM, Brad Harper wrote: I've debugged this down far enough to see that the GetModel object is being interpreted correctly, but the id param is never bound to this object. Any thoughts? On 7/31/07, Brad Harper [EMAIL PROTECTED] wrote: My get (all) requests (/services/rest/productTypes) are working. They return xml like this... ns1:getProductTypesResponse ProductTypes descriptionPaper/description id10/id /ProductTypes ProductTypes descriptionCanvas/description id11/id /ProductTypes /ns1:getProductTypesResponse My get individual requests (/services/rest/productTypes/1) are failing because the id property of the GetModel object is null. Any ideas? Code/config below config: bean id=RestServiceImpl class= com.gdservices.service.thirdparty.RestServiceImpl property name=daoFactory ref bean=hibernateDAOFactory/ /property /bean !-- REST -- jaxws:endpoint id=restRest implementor=#RestServiceImpl address=/rest bindingUri= http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class= org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=true / /bean /jaxws:serviceFactory /jaxws:endpoint Service: @WebService( targetNamespace = http:// restService.service.gdservices.com/ ) public interface RestService { @Get @HttpResource(location=/productTypes) @WebResult(name = ProductTypes) public ListTpMetaData getProductTypes() throws ServiceException; @Get @HttpResource(location=/productTypes/{id}) public TpMetaData getProductType(@WebParam(name = GetModel) GetModel getModel) throws ServiceException ; } Param Object: @XmlRootElement(name = GetModel) public class GetModel { private long id; public long getId() { return id; } public void setId(long id) { this.id = id; } } Mansour :-) Mansour :-)
Re: Rest GET params coming in null...
Check out http://cwiki.apache.org/CXF20DOC/http-binding.html and the bottom it explains the difference. Sure why technically it makes a difference. Mansour :-) On Aug 1, 2007, at 2:26 PM, Brad Harper wrote: That worked actually. Unfortunately, I don't understand technically why -bh On 8/1/07, Mansour Raad [EMAIL PROTECTED] wrote: BTW.there might be an issue with itI did try it using the restful_http_binding sample and no go. Raised a JIRA On Aug 1, 2007, at 2:01 PM, Brad Harper wrote: Is that done with an annotation? On 8/1/07, Mansour Raad [EMAIL PROTECTED] wrote: Just a shot in the dark herecould setting wrapped to false help ? Mansour :-) On Aug 1, 2007, at 11:49 AM, Brad Harper wrote: I've debugged this down far enough to see that the GetModel object is being interpreted correctly, but the id param is never bound to this object. Any thoughts? On 7/31/07, Brad Harper [EMAIL PROTECTED] wrote: My get (all) requests (/services/rest/productTypes) are working. They return xml like this... ns1:getProductTypesResponse ProductTypes descriptionPaper/description id10/id /ProductTypes ProductTypes descriptionCanvas/description id11/id /ProductTypes /ns1:getProductTypesResponse My get individual requests (/services/rest/productTypes/1) are failing because the id property of the GetModel object is null. Any ideas? Code/config below config: bean id=RestServiceImpl class= com.gdservices.service.thirdparty.RestServiceImpl property name=daoFactory ref bean=hibernateDAOFactory/ /property /bean !-- REST -- jaxws:endpoint id=restRest implementor=#RestServiceImpl address=/rest bindingUri= http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class= org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=true / /bean /jaxws:serviceFactory /jaxws:endpoint Service: @WebService( targetNamespace = http:// restService.service.gdservices.com/ ) public interface RestService { @Get @HttpResource(location=/productTypes) @WebResult(name = ProductTypes) public ListTpMetaData getProductTypes() throws ServiceException; @Get @HttpResource(location=/productTypes/{id}) public TpMetaData getProductType(@WebParam(name = GetModel) GetModel getModel) throws ServiceException ; } Param Object: @XmlRootElement(name = GetModel) public class GetModel { private long id; public long getId() { return id; } public void setId(long id) { this.id = id; } } Mansour :-) Mansour :-) Mansour :-)
restful parameters setting
given the following annotated method in an interface @Get @HttpResource(location = /{first},{last}) @WebResult(name = nameInfo) NameInfo getName( @WebParam(name = nameOptions) NameOptions nameOptions ); the nameOptions.first and nameOptions.last are populated properly when delimited by a comma, however using: @HttpResource(location = /{first}/{last}) note here it is delimited by a slash (/), then only the last property is set. Any hints are very much appreciated. Mansour :-)
Re: http rest sample does not compile
OK, now it compiles, but now I get the following warning: server: [java] Jul 30, 2007 9:32:53 AM org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver initHandlerMappings [java] WARNING: Ignoring namespace handler [org.apache.cxf.transport.http_jetty.spring.NamespaceHandler]: problem with handler class file or dependent class [java] java.lang.NoClassDefFoundError: org/apache/cxf/transport/ http_jetty/spring/JettyHTTPServerEngineBeanDefinitionParser [java] at org.apache.cxf.transport.http_jetty.spring.NamespaceHandler.init (NamespaceHandler.java:27) [java] at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.in itHandlerMappings(DefaultNamespaceHandlerResolver.java:123) [java] at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.i nit(DefaultNamespaceHandlerResolver.java:96) [java] at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.i nit(DefaultNamespaceHandlerResolver.java:70) [java] at org.apache.cxf.bus.spring.BusApplicationContext.initBeanDefinitionReader (BusApplicationContext.java:166) [java] at org.springframework.context.support.AbstractXmlApplicationContext.loadBe anDefinitions(AbstractXmlApplicationContext.java:78) [java] at org.springframework.context.support.AbstractRefreshableApplicationContex t.refreshBeanFactory(AbstractRefreshableApplicationContext.java:100) [java] at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:313) [java] at org.apache.cxf.bus.spring.BusApplicationContext.init (BusApplicationContext.java:71) [java] at org.apache.cxf.bus.spring.SpringBusFactory.createBus (SpringBusFactory.java:79) [java] at org.apache.cxf.bus.spring.SpringBusFactory.createBus (SpringBusFactory.java:64) [java] at org.apache.cxf.bus.spring.SpringBusFactory.createBus (SpringBusFactory.java:51) [java] at org.apache.cxf.BusFactory.getDefaultBus (BusFactory.java:68) [java] at org.apache.cxf.BusFactory.getDefaultBus (BusFactory.java:57) [java] at org.apache.cxf.BusFactory.getThreadDefaultBus (BusFactory.java:97) [java] at org.apache.cxf.frontend.AbstractEndpointFactory.getBus (AbstractEndpointFactory.java:274) [java] at org.apache.cxf.frontend.AbstractEndpointFactory.initializeServiceFactory (AbstractEndpointFactory.java:150) [java] at org.apache.cxf.frontend.ServerFactoryBean.initializeServiceFactory (ServerFactoryBean.java:144) [java] at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint (AbstractEndpointFactory.java:80) [java] at org.apache.cxf.frontend.ServerFactoryBean.create (ServerFactoryBean.java:108) [java] at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create (JaxWsServerFactoryBean.java:129) [java] at com.acme.customer.Main.createSoapService (Main.java:132) [java] at com.acme.customer.Main.main(Main.java:53) [java] Started CustomerService! [java] Server ready... Am I missing something ? On Jul 30, 2007, at 8:16 AM, Liu, Jervis wrote: Thanks for the report. Fixed. Cheers, Jervis -Original Message- From: Mansour Raad [mailto:[EMAIL PROTECTED] Sent: 2007?7?30? 18:24 To: cxf-user@incubator.apache.org Subject: http rest sample does not compile svn up the latest. cd [install]/samples/restful_http_binding ant server I get the following: Buildfile: build.xml maybe.generate.code: compile: [mkdir] Created dir: /Users/mansour/apache-cxf-2.1-incubator- SNAPSHOT/samples/restful_http_binding/build/classes [mkdir] Created dir: /Users/mansour/apache-cxf-2.1-incubator- SNAPSHOT/samples/restful_http_binding/build/src [javac] Compiling 11 source files to /Users/mansour/apache- cxf-2.1-incubator-SNAPSHOT/samples/restful_http_binding/build/classes [javac] /Users/mansour/apache-cxf-2.1-incubator-SNAPSHOT/samples/ restful_http_binding/src/com/acme/customer/Main.java:44: package org.codehaus.jettison.mapped does not exist [javac] import org.codehaus.jettison.mapped.MappedXMLInputFactory; [javac] ^ [javac] /Users/mansour/apache-cxf-2.1-incubator-SNAPSHOT/samples/ restful_http_binding/src/com/acme/customer/Main.java:45: package org.codehaus.jettison.mapped does not exist [javac] import org.codehaus.jettison.mapped.MappedXMLOutputFactory; [javac] ^ [javac] /Users/mansour/apache-cxf-2.1-incubator-SNAPSHOT/samples/ restful_http_binding/src/com/acme/customer/Main.java:114: cannot find symbol [javac] symbol : class MappedXMLInputFactory [javac] location: class com.acme.customer.Main [javac] MappedXMLInputFactory xif = new MappedXMLInputFactory(nstojns); [javac] ^ [javac] /Users/mansour/apache-cxf-2.1
building cxf
svn up the latest and building using mvn -Dmaven.test.skip=true install -Peverything to build it. I'm getting the following (this just started with today's update ) Any clues what to do ? [INFO] [dependency:unpack-dependencies {execution: unpack-sources}] [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Failed to resolve artifact. GroupId: org.apache.cxf ArtifactId: cxf-api Version: 2.1-incubator-SNAPSHOT Reason: Unable to download the artifact from any repository Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.apache.cxf - DartifactId=cxf-api \ -Dversion=2.1-incubator-SNAPSHOT -Dpackaging=java-source - Dfile=/path/to/file org.apache.cxf:cxf-api:java-source:2.1-incubator-SNAPSHOT Mansour :-)
Re: Dependency Injection in JAXWS endpoint
Sorryreplace the implementor, not the id. Mansour :-) On Jul 26, 2007, at 6:49 PM, Mansour Raad wrote: Create a bean as follows: bean id=reportingServiceImpl class=com.visualio.reportserver.webservices.ReportingServiceImpl !-- set properties here -- /bean Replace the jaxws:endpoint id with id=#reportingServiceImpl Mansour :-) On Jul 26, 2007, at 6:44 PM, Jeremy Isikoff wrote: I have an endpoint declaration like this in my beans.xml file, the trouble is the implementing class needs to get hold of some other spring beans (mainly DAOs) so it can do its work. How can I inject these in or get the application context from within this implementation class? If this was a normal bean declaration id just inject the DAOs but I dont know what to do with a Jaxws:endpoint bean? Any clues? jaxws:endpoint id=reportingService implementor=com.visualio.reportserver.webservices.ReportingServiceIm pl address=/ReportingService / Jeremy M. Isikoff _ ___ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=listsid=396545433 Mansour :-) Mansour :-)
Re: Dependency Injection in JAXWS endpoint
Create a bean as follows: bean id=reportingServiceImpl class=com.visualio.reportserver.webservices.ReportingServiceImpl !-- set properties here -- /bean Replace the jaxws:endpoint id with id=#reportingServiceImpl Mansour :-) On Jul 26, 2007, at 6:44 PM, Jeremy Isikoff wrote: I have an endpoint declaration like this in my beans.xml file, the trouble is the implementing class needs to get hold of some other spring beans (mainly DAOs) so it can do its work. How can I inject these in or get the application context from within this implementation class? If this was a normal bean declaration id just inject the DAOs but I dont know what to do with a Jaxws:endpoint bean? Any clues? jaxws:endpoint id=reportingService implementor=com.visualio.reportserver.webservices.ReportingServiceImp l address=/ReportingService / Jeremy M. Isikoff __ __ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=listsid=396545433 Mansour :-)
Re: POSTing customer using REST
Good pointer...had to introduce to the classpath the compiled file package-info.java with the following content @javax.xml.bind.annotation.XmlSchema( namespace = http://customer.acme.com;, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED ) package com.acme.customer; and all is fine. Thanks. On Jul 24, 2007, at 2:38 AM, Liu, Jervis wrote: Hi Mansour, do you have targetNamespace attribute defined in your WebService annotation, such as @WebService(targetNamespace = http://book.acme.com;)? This targetNamespace is needed for marshal/ unmarshal between input and your Customer object. There were similar problem reported in the mailing list when targetNamespace is missing. If this does not help, you may want to post out your service interface/impl code. Thanks, Jervis -Original Message- From: Mansour Raad [mailto:[EMAIL PROTECTED] Sent: 2007?7?24? 9:49 To: cxf-user@incubator.apache.org Subject: POSTing customer using REST Given the customer http rest sample, I defined a spring config with the following endpoint: jaxws:endpoint id=customerServiceXML implementor=com.esri.aws.CustomerService address=/xml bindingUri=http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=false/ /bean /jaxws:serviceFactory /jaxws:endpoint I'm bootstrapping CXF from tomcat using the following web.xml context-param param-namecontextConfigLocation/param-name param-valueclasspath:applicationContext.xml/param-value /context-param listener display-nameSpring Context Loader/display-name listener- classorg.springframework.web.context.ContextLoaderListener/listener- class /listener servlet servlet-nameCXFServlet/servlet-name servlet-classorg.apache.cxf.transport.servlet.CXFServlet/ servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameCXFServlet/servlet-name url-pattern/cxf/*/url-pattern /servlet-mapping When I post a request using wget --post-file add.xml http://localhost:8080/cxf/xml/customers I can see the function being called, however the name is null in the customer argument any clues Thanks. Mansour :-) IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland Mansour :-)
POSTing customer using REST
Given the customer http rest sample, I defined a spring config with the following endpoint: jaxws:endpoint id=customerServiceXML implementor=com.esri.aws.CustomerService address=/xml bindingUri=http://apache.org/cxf/binding/http; jaxws:serviceFactory bean class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean property name=wrapped value=false/ /bean /jaxws:serviceFactory /jaxws:endpoint I'm bootstrapping CXF from tomcat using the following web.xml context-param param-namecontextConfigLocation/param-name param-valueclasspath:applicationContext.xml/param-value /context-param listener display-nameSpring Context Loader/display-name listener- classorg.springframework.web.context.ContextLoaderListener/listener- class /listener servlet servlet-nameCXFServlet/servlet-name servlet-classorg.apache.cxf.transport.servlet.CXFServlet/ servlet-class load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameCXFServlet/servlet-name url-pattern/cxf/*/url-pattern /servlet-mapping When I post a request using wget --post-file add.xml http://localhost:8080/cxf/xml/customers I can see the function being called, however the name is null in the customer argument any clues Thanks. Mansour :-)