You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mansour Raad <mr...@esri.com> on 2007/07/24 03:49:19 UTC

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-name>contextConfigLocation</param-name>
         <param-value>classpath:applicationContext.xml</param-value>
     </context-param>

     <listener>
         <display-name>Spring Context Loader</display-name>
         <listener- 
class>org.springframework.web.context.ContextLoaderListener</listener- 
class>
     </listener>

     <servlet>
         <servlet-name>CXFServlet</servlet-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>/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
:-)




Re: POSTing customer using REST

Posted by Mansour Raad <mr...@esri.com>.
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:mraad@esri.com]
> 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-name>contextConfigLocation</param-name>
>          <param-value>classpath:applicationContext.xml</param-value>
>      </context-param>
>
>      <listener>
>          <display-name>Spring Context Loader</display-name>
>          <listener-
> class>org.springframework.web.context.ContextLoaderListener</listener-
> class>
>      </listener>
>
>      <servlet>
>          <servlet-name>CXFServlet</servlet-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>/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
:-)




RE: POSTing customer using REST

Posted by "Liu, Jervis" <jl...@iona.com>.
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:mraad@esri.com]
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-name>contextConfigLocation</param-name>
         <param-value>classpath:applicationContext.xml</param-value>
     </context-param>

     <listener>
         <display-name>Spring Context Loader</display-name>
         <listener- 
class>org.springframework.web.context.ContextLoaderListener</listener- 
class>
     </listener>

     <servlet>
         <servlet-name>CXFServlet</servlet-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>/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