You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mattmadhavan <ma...@yahoo.com> on 2007/09/21 21:59:44 UTC

CXFServlet + WebServices + Spring MVC

Hello,
I am currently working on a project for my current client for all external
notifications. My requirements are as follows:
 * Some of my client's partners communicate via Straight HTTP Post - Data
can be HTTP (I guess I can use REST for this - but not all of them send
XML!) 
* Some do via SOAP.

This is for a premiums and thats how my client makes his money and I would
like to give them a robust solution.

I would like to use CXF Servlet (Or straight Spring Dispatcher Servelt)and
also add Spring MVC controller so that I can add some actions for non-soap
based communications - be it a XML - or any other data format.

How can I combine these two! XFire had a solution where you use Straight
Spring Dispatcher Servlet and use a class called XFireExporter bean and have
a url mapping on the MVC side! (XFireExporter implements a spring
controller).


 The CXF migration says I do not need this as the *ServerFactoryBean takes
care of this! I am little confused! Any idead where I can map the urls in
the MVC to controllers including CXF Webservices as XFire did? 

Any help will be appreciated.

Thanks
Matt
-- 
View this message in context: http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12828806
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFServlet + WebServices + Spring MVC

Posted by Vincenzo Vitale <vi...@gmail.com>.
Great, it works!!!! :-)


Thank you very much,
V.

On 9/24/07, Daniel Kulp <dk...@apache.org> wrote:
>
>
>
> Vincenzo,
>
> We're currently voting on 2.0.2 which should hopefully be released
> tomorrow afternoon.   You can grab the release candidates from:
> http://people.apache.org/~dkulp/stage_cxf/2.0.2-incubator-take2/
>
> I'm note sure what the specific bug was that you're encountering, but it
> MAY be fixed in that build.
>
> Dan
>
>
>
> On Monday 24 September 2007, Vincenzo Vitale wrote:
> > I have just tried to use the snapshot version (2.1-incubator-SNAPSHOT)
> > and it worked nice, so I assume it was a bug.
> >
> > In my company (www.tomtom.com) we cannot release projects (we use the
> > maven release plugin) with snapshot dependencies and it would be
> > really a shame to renounce at cxf for this... and also I don't want to
> > write a Spring mvc controller for my rest services!!!! :-(
> >
> > Would it be possible to make available a no snapshot release with this
> > problem solved?
> >
> >
> > Thanks,
> > Vincenzo Vitale.
> >
> > On 9/24/07, vicio <vi...@gmail.com> wrote:
> > > Hello,
> > >
> > > have you solveed the problem.
> > >
> > >
> > > I have a simila r use  case. My methos is:
> > >
> > >     @WebMethod(operationName = "getKey", action = "account:GetKey",
> > > exclude
> > > = false)
> > >     @Get
> > >     @HttpResource(location =
> > > "/keys/{federatedAccountId}/{domainName}") SimpleResponse
> > > getKey(@WebParam(name = "federatedAccountId") String
> > > federatedAccountId, @WebParam(name = "domainName") String
> > > domainName);
> > >
> > > and in Spring:
> > >
> > >         <jaxws:endpoint id="accountWebServiceSoap"
> > >                 implementor="#accountWebServiceImpl"
> > > address="/soap/AccountService" />
> > >
> > >         <jaxws:endpoint id="accountWebServiceRest"
> > >                 implementor="#accountWebServiceImpl"
> > > address="/rest/AccountService"
> > >                 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>
> > >
> > >
> > > but when I try to call the rest url
> > > (http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the
> > > two parameters are not set (null value).
> > >
> > >
> > > Any suggestions?
> > >
> > > Thanks,
> > > V.
> > >
> > > RayKrueger wrote:
> > > > If you search back you'll see I worked through some similar
> > > > discussions in this area...
> > > >
> > > > I wanted to write one endpoint that could handle SOAP, POX and
> > > > REST. With some help I was able to get the SOAP and POX stuff
> > > > working great, REST however never seemed to set the properties, I
> > > > haven't spent much time looking at that part though...
> > > >
> > > > Basically we have a very heavily annotated endpoint interface and
> > > > impl declared in our ApplicationContext like this...
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <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
> > >
> > > http://cxf.apache.org/schemas/jaxws.xsd">
> > >
> > > >     <jaxws:endpoint id="soapCurrencyExchange"
> > > >                     implementor="#currencyExchangeImpl"
> > > >                     bindingUri="http://schemas.xmlsoap.org/soap/"
> > > >                     address="/CurrencyExchange.soap"/>
> > > >
> > > >     <jaxws:endpoint id="xmlCurrencyExchange"
> > > >                     implementor="#currencyExchangeImpl"
> > > >
> > > > bindingUri="http://cxf.apache.org/bindings/xformat"
> > > > address="/CurrencyExchange.xml"/>
> > > >
> > > >     <jaxws:endpoint id="restCurrencyExchange"
> > > >                     implementor="#currencyExchangeImpl"
> > > >
> > > > bindingUri="http://apache.org/cxf/binding/http"
> > > > address="/CurrencyExchange">
> > > >         <jaxws:serviceFactory>
> > > >             <bean
> > > > class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> > > >                 <property name="wrapped" value="true"/>
> > > >             </bean>
> > > >         </jaxws:serviceFactory>
> > > >     </jaxws:endpoint>
> > > >
> > > > </beans>
> > > >
> > > > My endpoint interface defines one method
> > > > "getExchangeRate(ExchangeRateRequest)". As I said, the SOAP and
> > > > POX mappings worked fine, but I never got REST to work. The method
> > > > would be invoked by the properties I had defined in the
> > > > @HttpResource annotation would never be set on the
> > > > ExchangeRateRequest object.
> > > >
> > > > So when I'd annotated it as...
> > > > @HttpResource(location="/rates/{fromCurrency},{toCurrency}")
> > > > getExchangeRate(ExchangeRateRequest request)
> > > >
> > > > ...I'd end up with nulls when I called request.getFromCurrency and
> > > > getToCurrency. Again, the method was invoked, the
> > > > ExchangeRateRequest object was instantiated, but the properties
> > > > never got set. Maybe it can't be a JAXB generated class or
> > > > something...
> > > >
> > > > On 9/21/07, mattmadhavan <ma...@yahoo.com> wrote:
> > > >> Hello,
> > > >> I am currently working on a project for my current client for all
> > > >> external
> > > >> notifications. My requirements are as follows:
> > > >>  * Some of my client's partners communicate via Straight HTTP
> > > >> Post -
> > >
> > > Data
> > >
> > > >> can be HTTP (I guess I can use REST for this - but not all of
> > > >> them send XML!)
> > > >> * Some do via SOAP.
> > > >>
> > > >> This is for a premiums and thats how my client makes his money
> > > >> and I would
> > > >> like to give them a robust solution.
> > > >>
> > > >> I would like to use CXF Servlet (Or straight Spring Dispatcher
> > > >> Servelt)and
> > > >> also add Spring MVC controller so that I can add some actions for
> > > >> non-soap
> > > >> based communications - be it a XML - or any other data format.
> > > >>
> > > >> How can I combine these two! XFire had a solution where you use
> > >
> > > Straight
> > >
> > > >> Spring Dispatcher Servlet and use a class called XFireExporter
> > > >> bean and have
> > > >> a url mapping on the MVC side! (XFireExporter implements a spring
> > > >> controller).
> > > >>
> > > >>
> > > >>  The CXF migration says I do not need this as the
> > > >> *ServerFactoryBean takes
> > > >> care of this! I am little confused! Any idead where I can map the
> > > >> urls
> > >
> > > in
> > >
> > > >> the MVC to controllers including CXF Webservices as XFire did?
> > > >>
> > > >> Any help will be appreciated.
> > > >>
> > > >> Thanks
> > > >> Matt
> > > >> --
> > > >> View this message in context:
> > >
> > > http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf44
> > >98268.html#a12828806
> > >
> > > >> Sent from the cxf-user mailing list archive at Nabble.com.
> > >
> > > --
> > > View this message in context:
> > > http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf44
> > >98268.html#a12855895 Sent from the cxf-user mailing list archive at
> > > Nabble.com.
>
>
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>

Re: CXFServlet + WebServices + Spring MVC

Posted by Daniel Kulp <dk...@apache.org>.

Vincenzo,

We're currently voting on 2.0.2 which should hopefully be released 
tomorrow afternoon.   You can grab the release candidates from:
http://people.apache.org/~dkulp/stage_cxf/2.0.2-incubator-take2/

I'm note sure what the specific bug was that you're encountering, but it 
MAY be fixed in that build.   

Dan



On Monday 24 September 2007, Vincenzo Vitale wrote:
> I have just tried to use the snapshot version (2.1-incubator-SNAPSHOT)
> and it worked nice, so I assume it was a bug.
>
> In my company (www.tomtom.com) we cannot release projects (we use the
> maven release plugin) with snapshot dependencies and it would be
> really a shame to renounce at cxf for this... and also I don't want to
> write a Spring mvc controller for my rest services!!!! :-(
>
> Would it be possible to make available a no snapshot release with this
> problem solved?
>
>
> Thanks,
> Vincenzo Vitale.
>
> On 9/24/07, vicio <vi...@gmail.com> wrote:
> > Hello,
> >
> > have you solveed the problem.
> >
> >
> > I have a simila r use  case. My methos is:
> >
> >     @WebMethod(operationName = "getKey", action = "account:GetKey",
> > exclude
> > = false)
> >     @Get
> >     @HttpResource(location =
> > "/keys/{federatedAccountId}/{domainName}") SimpleResponse
> > getKey(@WebParam(name = "federatedAccountId") String
> > federatedAccountId, @WebParam(name = "domainName") String
> > domainName);
> >
> > and in Spring:
> >
> >         <jaxws:endpoint id="accountWebServiceSoap"
> >                 implementor="#accountWebServiceImpl"
> > address="/soap/AccountService" />
> >
> >         <jaxws:endpoint id="accountWebServiceRest"
> >                 implementor="#accountWebServiceImpl"
> > address="/rest/AccountService"
> >                 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>
> >
> >
> > but when I try to call the rest url
> > (http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the
> > two parameters are not set (null value).
> >
> >
> > Any suggestions?
> >
> > Thanks,
> > V.
> >
> > RayKrueger wrote:
> > > If you search back you'll see I worked through some similar
> > > discussions in this area...
> > >
> > > I wanted to write one endpoint that could handle SOAP, POX and
> > > REST. With some help I was able to get the SOAP and POX stuff
> > > working great, REST however never seemed to set the properties, I
> > > haven't spent much time looking at that part though...
> > >
> > > Basically we have a very heavily annotated endpoint interface and
> > > impl declared in our ApplicationContext like this...
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <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
> >
> > http://cxf.apache.org/schemas/jaxws.xsd">
> >
> > >     <jaxws:endpoint id="soapCurrencyExchange"
> > >                     implementor="#currencyExchangeImpl"
> > >                     bindingUri="http://schemas.xmlsoap.org/soap/"
> > >                     address="/CurrencyExchange.soap"/>
> > >
> > >     <jaxws:endpoint id="xmlCurrencyExchange"
> > >                     implementor="#currencyExchangeImpl"
> > >                    
> > > bindingUri="http://cxf.apache.org/bindings/xformat"
> > > address="/CurrencyExchange.xml"/>
> > >
> > >     <jaxws:endpoint id="restCurrencyExchange"
> > >                     implementor="#currencyExchangeImpl"
> > >                    
> > > bindingUri="http://apache.org/cxf/binding/http"
> > > address="/CurrencyExchange">
> > >         <jaxws:serviceFactory>
> > >             <bean
> > > class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> > >                 <property name="wrapped" value="true"/>
> > >             </bean>
> > >         </jaxws:serviceFactory>
> > >     </jaxws:endpoint>
> > >
> > > </beans>
> > >
> > > My endpoint interface defines one method
> > > "getExchangeRate(ExchangeRateRequest)". As I said, the SOAP and
> > > POX mappings worked fine, but I never got REST to work. The method
> > > would be invoked by the properties I had defined in the
> > > @HttpResource annotation would never be set on the
> > > ExchangeRateRequest object.
> > >
> > > So when I'd annotated it as...
> > > @HttpResource(location="/rates/{fromCurrency},{toCurrency}")
> > > getExchangeRate(ExchangeRateRequest request)
> > >
> > > ...I'd end up with nulls when I called request.getFromCurrency and
> > > getToCurrency. Again, the method was invoked, the
> > > ExchangeRateRequest object was instantiated, but the properties
> > > never got set. Maybe it can't be a JAXB generated class or
> > > something...
> > >
> > > On 9/21/07, mattmadhavan <ma...@yahoo.com> wrote:
> > >> Hello,
> > >> I am currently working on a project for my current client for all
> > >> external
> > >> notifications. My requirements are as follows:
> > >>  * Some of my client's partners communicate via Straight HTTP
> > >> Post -
> >
> > Data
> >
> > >> can be HTTP (I guess I can use REST for this - but not all of
> > >> them send XML!)
> > >> * Some do via SOAP.
> > >>
> > >> This is for a premiums and thats how my client makes his money
> > >> and I would
> > >> like to give them a robust solution.
> > >>
> > >> I would like to use CXF Servlet (Or straight Spring Dispatcher
> > >> Servelt)and
> > >> also add Spring MVC controller so that I can add some actions for
> > >> non-soap
> > >> based communications - be it a XML - or any other data format.
> > >>
> > >> How can I combine these two! XFire had a solution where you use
> >
> > Straight
> >
> > >> Spring Dispatcher Servlet and use a class called XFireExporter
> > >> bean and have
> > >> a url mapping on the MVC side! (XFireExporter implements a spring
> > >> controller).
> > >>
> > >>
> > >>  The CXF migration says I do not need this as the
> > >> *ServerFactoryBean takes
> > >> care of this! I am little confused! Any idead where I can map the
> > >> urls
> >
> > in
> >
> > >> the MVC to controllers including CXF Webservices as XFire did?
> > >>
> > >> Any help will be appreciated.
> > >>
> > >> Thanks
> > >> Matt
> > >> --
> > >> View this message in context:
> >
> > http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf44
> >98268.html#a12828806
> >
> > >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> > --
> > View this message in context:
> > http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf44
> >98268.html#a12855895 Sent from the cxf-user mailing list archive at
> > Nabble.com.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: CXFServlet + WebServices + Spring MVC

Posted by Vincenzo Vitale <vi...@gmail.com>.
I have just tried to use the snapshot version (2.1-incubator-SNAPSHOT) and
it worked nice, so I assume it was a bug.

In my company (www.tomtom.com) we cannot release projects (we use the maven
release plugin) with snapshot dependencies and it would be really a shame to
renounce at cxf for this... and also I don't want to write a Spring mvc
controller for my rest services!!!! :-(

Would it be possible to make available a no snapshot release with this
problem solved?


Thanks,
Vincenzo Vitale.

On 9/24/07, vicio <vi...@gmail.com> wrote:
>
>
> Hello,
>
> have you solveed the problem.
>
>
> I have a simila r use  case. My methos is:
>
>     @WebMethod(operationName = "getKey", action = "account:GetKey",
> exclude
> = false)
>     @Get
>     @HttpResource(location = "/keys/{federatedAccountId}/{domainName}")
>     SimpleResponse getKey(@WebParam(name = "federatedAccountId")
>     String federatedAccountId, @WebParam(name = "domainName")
>     String domainName);
>
> and in Spring:
>
>         <jaxws:endpoint id="accountWebServiceSoap"
>                 implementor="#accountWebServiceImpl"
> address="/soap/AccountService" />
>
>         <jaxws:endpoint id="accountWebServiceRest"
>                 implementor="#accountWebServiceImpl"
> address="/rest/AccountService"
>                 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>
>
>
> but when I try to call the rest url
> (http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the two
> parameters are not set (null value).
>
>
> Any suggestions?
>
> Thanks,
> V.
>
> RayKrueger wrote:
> >
> > If you search back you'll see I worked through some similar
> > discussions in this area...
> >
> > I wanted to write one endpoint that could handle SOAP, POX and REST.
> > With some help I was able to get the SOAP and POX stuff working great,
> > REST however never seemed to set the properties, I haven't spent much
> > time looking at that part though...
> >
> > Basically we have a very heavily annotated endpoint interface and impl
> > declared in our ApplicationContext like this...
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <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
> http://cxf.apache.org/schemas/jaxws.xsd">
> >
> >     <jaxws:endpoint id="soapCurrencyExchange"
> >                     implementor="#currencyExchangeImpl"
> >                     bindingUri="http://schemas.xmlsoap.org/soap/"
> >                     address="/CurrencyExchange.soap"/>
> >
> >     <jaxws:endpoint id="xmlCurrencyExchange"
> >                     implementor="#currencyExchangeImpl"
> >                     bindingUri="http://cxf.apache.org/bindings/xformat"
> >                     address="/CurrencyExchange.xml"/>
> >
> >     <jaxws:endpoint id="restCurrencyExchange"
> >                     implementor="#currencyExchangeImpl"
> >                     bindingUri="http://apache.org/cxf/binding/http"
> >                     address="/CurrencyExchange">
> >         <jaxws:serviceFactory>
> >             <bean
> > class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> >                 <property name="wrapped" value="true"/>
> >             </bean>
> >         </jaxws:serviceFactory>
> >     </jaxws:endpoint>
> >
> > </beans>
> >
> > My endpoint interface defines one method
> > "getExchangeRate(ExchangeRateRequest)". As I said, the SOAP and POX
> > mappings worked fine, but I never got REST to work. The method would
> > be invoked by the properties I had defined in the @HttpResource
> > annotation would never be set on the ExchangeRateRequest object.
> >
> > So when I'd annotated it as...
> > @HttpResource(location="/rates/{fromCurrency},{toCurrency}")
> > getExchangeRate(ExchangeRateRequest request)
> >
> > ...I'd end up with nulls when I called request.getFromCurrency and
> > getToCurrency. Again, the method was invoked, the ExchangeRateRequest
> > object was instantiated, but the properties never got set. Maybe it
> > can't be a JAXB generated class or something...
> > On 9/21/07, mattmadhavan <ma...@yahoo.com> wrote:
> >>
> >> Hello,
> >> I am currently working on a project for my current client for all
> >> external
> >> notifications. My requirements are as follows:
> >>  * Some of my client's partners communicate via Straight HTTP Post -
> Data
> >> can be HTTP (I guess I can use REST for this - but not all of them send
> >> XML!)
> >> * Some do via SOAP.
> >>
> >> This is for a premiums and thats how my client makes his money and I
> >> would
> >> like to give them a robust solution.
> >>
> >> I would like to use CXF Servlet (Or straight Spring Dispatcher
> >> Servelt)and
> >> also add Spring MVC controller so that I can add some actions for
> >> non-soap
> >> based communications - be it a XML - or any other data format.
> >>
> >> How can I combine these two! XFire had a solution where you use
> Straight
> >> Spring Dispatcher Servlet and use a class called XFireExporter bean and
> >> have
> >> a url mapping on the MVC side! (XFireExporter implements a spring
> >> controller).
> >>
> >>
> >>  The CXF migration says I do not need this as the *ServerFactoryBean
> >> takes
> >> care of this! I am little confused! Any idead where I can map the urls
> in
> >> the MVC to controllers including CXF Webservices as XFire did?
> >>
> >> Any help will be appreciated.
> >>
> >> Thanks
> >> Matt
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12828806
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12855895
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: CXFServlet + WebServices + Spring MVC

Posted by vicio <vi...@gmail.com>.
Hello,

have you solveed the problem.


I have a simila r use  case. My methos is:

    @WebMethod(operationName = "getKey", action = "account:GetKey", exclude
= false)
    @Get
    @HttpResource(location = "/keys/{federatedAccountId}/{domainName}")
    SimpleResponse getKey(@WebParam(name = "federatedAccountId")
    String federatedAccountId, @WebParam(name = "domainName")
    String domainName);

and in Spring:

	<jaxws:endpoint id="accountWebServiceSoap"
		implementor="#accountWebServiceImpl" address="/soap/AccountService" />

	<jaxws:endpoint id="accountWebServiceRest"
		implementor="#accountWebServiceImpl" address="/rest/AccountService"
		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>


but when I try to call the rest url
(http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the two
parameters are not set (null value).


Any suggestions?

Thanks,
V.

RayKrueger wrote:
> 
> If you search back you'll see I worked through some similar
> discussions in this area...
> 
> I wanted to write one endpoint that could handle SOAP, POX and REST.
> With some help I was able to get the SOAP and POX stuff working great,
> REST however never seemed to set the properties, I haven't spent much
> time looking at that part though...
> 
> Basically we have a very heavily annotated endpoint interface and impl
> declared in our ApplicationContext like this...
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <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 http://cxf.apache.org/schemas/jaxws.xsd">
> 
>     <jaxws:endpoint id="soapCurrencyExchange"
>                     implementor="#currencyExchangeImpl"
>                     bindingUri="http://schemas.xmlsoap.org/soap/"
>                     address="/CurrencyExchange.soap"/>
> 
>     <jaxws:endpoint id="xmlCurrencyExchange"
>                     implementor="#currencyExchangeImpl"
>                     bindingUri="http://cxf.apache.org/bindings/xformat"
>                     address="/CurrencyExchange.xml"/>
> 
>     <jaxws:endpoint id="restCurrencyExchange"
>                     implementor="#currencyExchangeImpl"
>                     bindingUri="http://apache.org/cxf/binding/http"
>                     address="/CurrencyExchange">
>         <jaxws:serviceFactory>
>             <bean
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>                 <property name="wrapped" value="true"/>
>             </bean>
>         </jaxws:serviceFactory>
>     </jaxws:endpoint>
> 
> </beans>
> 
> My endpoint interface defines one method
> "getExchangeRate(ExchangeRateRequest)". As I said, the SOAP and POX
> mappings worked fine, but I never got REST to work. The method would
> be invoked by the properties I had defined in the @HttpResource
> annotation would never be set on the ExchangeRateRequest object.
> 
> So when I'd annotated it as...
> @HttpResource(location="/rates/{fromCurrency},{toCurrency}")
> getExchangeRate(ExchangeRateRequest request)
> 
> ...I'd end up with nulls when I called request.getFromCurrency and
> getToCurrency. Again, the method was invoked, the ExchangeRateRequest
> object was instantiated, but the properties never got set. Maybe it
> can't be a JAXB generated class or something...
> On 9/21/07, mattmadhavan <ma...@yahoo.com> wrote:
>>
>> Hello,
>> I am currently working on a project for my current client for all
>> external
>> notifications. My requirements are as follows:
>>  * Some of my client's partners communicate via Straight HTTP Post - Data
>> can be HTTP (I guess I can use REST for this - but not all of them send
>> XML!)
>> * Some do via SOAP.
>>
>> This is for a premiums and thats how my client makes his money and I
>> would
>> like to give them a robust solution.
>>
>> I would like to use CXF Servlet (Or straight Spring Dispatcher
>> Servelt)and
>> also add Spring MVC controller so that I can add some actions for
>> non-soap
>> based communications - be it a XML - or any other data format.
>>
>> How can I combine these two! XFire had a solution where you use Straight
>> Spring Dispatcher Servlet and use a class called XFireExporter bean and
>> have
>> a url mapping on the MVC side! (XFireExporter implements a spring
>> controller).
>>
>>
>>  The CXF migration says I do not need this as the *ServerFactoryBean
>> takes
>> care of this! I am little confused! Any idead where I can map the urls in
>> the MVC to controllers including CXF Webservices as XFire did?
>>
>> Any help will be appreciated.
>>
>> Thanks
>> Matt
>> --
>> View this message in context:
>> http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12828806
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12855895
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXFServlet + WebServices + Spring MVC

Posted by Ray Krueger <ra...@gmail.com>.
If you search back you'll see I worked through some similar
discussions in this area...

I wanted to write one endpoint that could handle SOAP, POX and REST.
With some help I was able to get the SOAP and POX stuff working great,
REST however never seemed to set the properties, I haven't spent much
time looking at that part though...

Basically we have a very heavily annotated endpoint interface and impl
declared in our ApplicationContext like this...

<?xml version="1.0" encoding="UTF-8"?>
<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 http://cxf.apache.org/schemas/jaxws.xsd">

    <jaxws:endpoint id="soapCurrencyExchange"
                    implementor="#currencyExchangeImpl"
                    bindingUri="http://schemas.xmlsoap.org/soap/"
                    address="/CurrencyExchange.soap"/>

    <jaxws:endpoint id="xmlCurrencyExchange"
                    implementor="#currencyExchangeImpl"
                    bindingUri="http://cxf.apache.org/bindings/xformat"
                    address="/CurrencyExchange.xml"/>

    <jaxws:endpoint id="restCurrencyExchange"
                    implementor="#currencyExchangeImpl"
                    bindingUri="http://apache.org/cxf/binding/http"
                    address="/CurrencyExchange">
        <jaxws:serviceFactory>
            <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
                <property name="wrapped" value="true"/>
            </bean>
        </jaxws:serviceFactory>
    </jaxws:endpoint>

</beans>

My endpoint interface defines one method
"getExchangeRate(ExchangeRateRequest)". As I said, the SOAP and POX
mappings worked fine, but I never got REST to work. The method would
be invoked by the properties I had defined in the @HttpResource
annotation would never be set on the ExchangeRateRequest object.

So when I'd annotated it as...
@HttpResource(location="/rates/{fromCurrency},{toCurrency}")
getExchangeRate(ExchangeRateRequest request)

...I'd end up with nulls when I called request.getFromCurrency and
getToCurrency. Again, the method was invoked, the ExchangeRateRequest
object was instantiated, but the properties never got set. Maybe it
can't be a JAXB generated class or something...
On 9/21/07, mattmadhavan <ma...@yahoo.com> wrote:
>
> Hello,
> I am currently working on a project for my current client for all external
> notifications. My requirements are as follows:
>  * Some of my client's partners communicate via Straight HTTP Post - Data
> can be HTTP (I guess I can use REST for this - but not all of them send
> XML!)
> * Some do via SOAP.
>
> This is for a premiums and thats how my client makes his money and I would
> like to give them a robust solution.
>
> I would like to use CXF Servlet (Or straight Spring Dispatcher Servelt)and
> also add Spring MVC controller so that I can add some actions for non-soap
> based communications - be it a XML - or any other data format.
>
> How can I combine these two! XFire had a solution where you use Straight
> Spring Dispatcher Servlet and use a class called XFireExporter bean and have
> a url mapping on the MVC side! (XFireExporter implements a spring
> controller).
>
>
>  The CXF migration says I do not need this as the *ServerFactoryBean takes
> care of this! I am little confused! Any idead where I can map the urls in
> the MVC to controllers including CXF Webservices as XFire did?
>
> Any help will be appreciated.
>
> Thanks
> Matt
> --
> View this message in context: http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12828806
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

RE: CXFServlet + WebServices + Spring MVC

Posted by mattmadhavan <ma...@yahoo.com>.
Hi Chris,
No, you understood my problem correctly. The problem you solved will work
for me!

But my question is since, the CXFServlet is the same as the Spring Servlet,
can I use the same servlet for both Webserices and spring MVC?

Any input to this question will be appreciated.

Thanks
Matt


CMoesel wrote:
> 
> Hi Matt,
> 
> Maybe I'm misunderstanding your question, but I think you just want to
> be able to use CXF and Spring MVC in the same application?  If that's
> it, I've done this simply by mapping the CXFServlet and
> DispatcherServlet to two different URL patterns.  For example:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>     version="2.4">
> 
>   <description>My Web Application</description>
>   <display-name>My Web Application</display-name>
> 
>   <context-param>
>     <param-name>contextConfigLocation</param-name>
>     <param-value>
>       classpath:my-cxf-config.xml
>       classpath:META-INF/cxf/cxf-servlet.xml
>     </param-value>
>   </context-param>
> 
>   <listener>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</l
> istener-class>
>   </listener>
> 
>   <servlet>
>     <servlet-name>CXFServlet</servlet-name>
>  
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-clas
> s>
>     <load-on-startup>1</load-on-startup>
>   </servlet>
> 
>   <servlet-mapping>
>     <servlet-name>CXFServlet</servlet-name>
>     <url-pattern>/services/*</url-pattern>
>   </servlet-mapping>
> 
>   <servlet>
>     <servlet-name>springmvc</servlet-name>
>  
> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servle
> t-class>
>     <load-on-startup>2</load-on-startup>
>   </servlet>
> 
>   <servlet-mapping>
>     <servlet-name>springmvc</servlet-name>
>     <url-pattern>/web/*</url-pattern>
>   </servlet-mapping>
> 
>  
> <welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-
> list>
> 
> </web-app>
> 
> -Chris
> 
> -----Original Message-----
> From: mattmadhavan [mailto:mattmadhavan@yahoo.com] 
> Sent: Friday, September 21, 2007 4:00 PM
> To: cxf-user@incubator.apache.org
> Subject: CXFServlet + WebServices + Spring MVC
> 
> 
> Hello,
> I am currently working on a project for my current client for all
> external
> notifications. My requirements are as follows:
>  * Some of my client's partners communicate via Straight HTTP Post -
> Data
> can be HTTP (I guess I can use REST for this - but not all of them send
> XML!) 
> * Some do via SOAP.
> 
> This is for a premiums and thats how my client makes his money and I
> would
> like to give them a robust solution.
> 
> I would like to use CXF Servlet (Or straight Spring Dispatcher
> Servelt)and
> also add Spring MVC controller so that I can add some actions for
> non-soap
> based communications - be it a XML - or any other data format.
> 
> How can I combine these two! XFire had a solution where you use Straight
> Spring Dispatcher Servlet and use a class called XFireExporter bean and
> have
> a url mapping on the MVC side! (XFireExporter implements a spring
> controller).
> 
> 
>  The CXF migration says I do not need this as the *ServerFactoryBean
> takes
> care of this! I am little confused! Any idead where I can map the urls
> in
> the MVC to controllers including CXF Webservices as XFire did? 
> 
> Any help will be appreciated.
> 
> Thanks
> Matt
> -- 
> View this message in context:
> http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf449826
> 8.html#a12828806
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf4498268.html#a12861059
Sent from the cxf-user mailing list archive at Nabble.com.


RE: CXFServlet + WebServices + Spring MVC

Posted by Christopher Moesel <Ch...@avid.com>.
Hi Matt,

Maybe I'm misunderstanding your question, but I think you just want to
be able to use CXF and Spring MVC in the same application?  If that's
it, I've done this simply by mapping the CXFServlet and
DispatcherServlet to two different URL patterns.  For example:

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

  <description>My Web Application</description>
  <display-name>My Web Application</display-name>

  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
      classpath:my-cxf-config.xml
      classpath:META-INF/cxf/cxf-servlet.xml
    </param-value>
  </context-param>

  <listener>
 
<listener-class>org.springframework.web.context.ContextLoaderListener</l
istener-class>
  </listener>

  <servlet>
    <servlet-name>CXFServlet</servlet-name>
 
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-clas
s>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>springmvc</servlet-name>
 
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servle
t-class>
    <load-on-startup>2</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>/web/*</url-pattern>
  </servlet-mapping>

 
<welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-
list>

</web-app>

-Chris

-----Original Message-----
From: mattmadhavan [mailto:mattmadhavan@yahoo.com] 
Sent: Friday, September 21, 2007 4:00 PM
To: cxf-user@incubator.apache.org
Subject: CXFServlet + WebServices + Spring MVC


Hello,
I am currently working on a project for my current client for all
external
notifications. My requirements are as follows:
 * Some of my client's partners communicate via Straight HTTP Post -
Data
can be HTTP (I guess I can use REST for this - but not all of them send
XML!) 
* Some do via SOAP.

This is for a premiums and thats how my client makes his money and I
would
like to give them a robust solution.

I would like to use CXF Servlet (Or straight Spring Dispatcher
Servelt)and
also add Spring MVC controller so that I can add some actions for
non-soap
based communications - be it a XML - or any other data format.

How can I combine these two! XFire had a solution where you use Straight
Spring Dispatcher Servlet and use a class called XFireExporter bean and
have
a url mapping on the MVC side! (XFireExporter implements a spring
controller).


 The CXF migration says I do not need this as the *ServerFactoryBean
takes
care of this! I am little confused! Any idead where I can map the urls
in
the MVC to controllers including CXF Webservices as XFire did? 

Any help will be appreciated.

Thanks
Matt
-- 
View this message in context:
http://www.nabble.com/CXFServlet-%2B-WebServices-%2B-Spring-MVC-tf449826
8.html#a12828806
Sent from the cxf-user mailing list archive at Nabble.com.