You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Aji John <aj...@gmail.com> on 2008/11/25 20:36:05 UTC

jax-rs and jax-ws

I've couple of services written ot for jax-rs requests, how can I easily
serve them over jax-ws with minimum coding ? I'm using beans.xml for
configuring , pls see the config below, i'm using cxf 2.1.1

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
  xmlns:cxf="http://cxf.apache.org/core"
  xsi:schemaLocation="
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
  http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
/>
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

  <jaxrs:server id="pQREST" address="/">
    <jaxrs:serviceBeans>
      <bean class="xx.yy.services.SessionService" />
    </jaxrs:serviceBeans>
    <jaxrs:entityProviders>
       <bean class="xx.yy.providers.TextXMLProvider" />
    </jaxrs:entityProviders>
    <jaxrs:inInterceptors>
     <bean class="xx.yy.interceptors.SessionInterceptor" />
    </jaxrs:inInterceptors>
    <jaxrs:features><cxf:logging /></jaxrs:features>
  </jaxrs:server>
</beans>

RE: jax-rs and jax-ws

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi - do you have any problems running jaxws service on the same port ?

Should not be a problem

Cheers, Sergey

-----Original Message-----
From: Aji John [mailto:aji.john@gmail.com] 
Sent: 05 December 2008 01:26
To: users@cxf.apache.org
Subject: Re: jax-rs and jax-ws

Can you run jaxws on the default http port as jaxrs ? i.e my rest is
using
tomcat 8080, can I've ws also on the same port

On Tue, Nov 25, 2008 at 1:42 PM, Sergey Beryozkin
<sb...@progress.com>wrote:

> Hi
>
> Lets assume you'd like to reuse SessionService bean.
>
> Have a look at [1] - it shows one simple way how by adding JAXWS
> annotations on SessionService you can make it jaxws-aware.
> Next have a look at [2] which shows one example of how you can
configure
> both jaxws and jaxrs. Note how a service bean is reused by both
> jaxws:endpoint and jaxrs:server. At the moment a different endpoint
> address is needed for jaxws and jaxrs endpoints.
>
> To have both jaxws and jaxrs play well together consider avoiding
> doc-literal-wrapped, unless a given method signature has a single
> parameter only.
>
> We'll have quite a few things coming in this area over time. By the
way,
> if you're using Jetty then you'd be able to use CXF Continuations API
> for both JAXWS and JAXRS to do suspended invocations in a
> transport-portable way. For ex, you can have continuations over
> SOAP-over-HTTP + SOAP-over-JMS plus plain HTTP supported transparently
-
> sorry can't help saying it even though you didn't ask :-)
>
> Cheers, Sergey
>
> [1]
>
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apa
> che/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
> [2]
>
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/ja
> xrs_soap_rest/WEB-INF/beans.xml
>
>
> -----Original Message-----
> From: Aji John [mailto:aji.john@gmail.com]
> Sent: 25 November 2008 19:36
> To: users@cxf.apache.org
> Subject: jax-rs and jax-ws
>
> I've couple of services written ot for jax-rs requests, how can I
easily
> serve them over jax-ws with minimum coding ? I'm using beans.xml for
> configuring , pls see the config below, i'm using cxf 2.1.1
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>  xmlns:cxf="http://cxf.apache.org/core"
>  xsi:schemaLocation="
>  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>  http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>  http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
>
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import
> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
> />
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>  <jaxrs:server id="pQREST" address="/">
>    <jaxrs:serviceBeans>
>      <bean class="xx.yy.services.SessionService" />
>    </jaxrs:serviceBeans>
>    <jaxrs:entityProviders>
>       <bean class="xx.yy.providers.TextXMLProvider" />
>    </jaxrs:entityProviders>
>    <jaxrs:inInterceptors>
>     <bean class="xx.yy.interceptors.SessionInterceptor" />
>    </jaxrs:inInterceptors>
>    <jaxrs:features><cxf:logging /></jaxrs:features>
>  </jaxrs:server>
> </beans>
>

Re: jax-rs and jax-ws

Posted by Aji John <aj...@gmail.com>.
Can you run jaxws on the default http port as jaxrs ? i.e my rest is using
tomcat 8080, can I've ws also on the same port

On Tue, Nov 25, 2008 at 1:42 PM, Sergey Beryozkin <sb...@progress.com>wrote:

> Hi
>
> Lets assume you'd like to reuse SessionService bean.
>
> Have a look at [1] - it shows one simple way how by adding JAXWS
> annotations on SessionService you can make it jaxws-aware.
> Next have a look at [2] which shows one example of how you can configure
> both jaxws and jaxrs. Note how a service bean is reused by both
> jaxws:endpoint and jaxrs:server. At the moment a different endpoint
> address is needed for jaxws and jaxrs endpoints.
>
> To have both jaxws and jaxrs play well together consider avoiding
> doc-literal-wrapped, unless a given method signature has a single
> parameter only.
>
> We'll have quite a few things coming in this area over time. By the way,
> if you're using Jetty then you'd be able to use CXF Continuations API
> for both JAXWS and JAXRS to do suspended invocations in a
> transport-portable way. For ex, you can have continuations over
> SOAP-over-HTTP + SOAP-over-JMS plus plain HTTP supported transparently -
> sorry can't help saying it even though you didn't ask :-)
>
> Cheers, Sergey
>
> [1]
> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apa
> che/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
> [2]
> http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/ja
> xrs_soap_rest/WEB-INF/beans.xml
>
>
> -----Original Message-----
> From: Aji John [mailto:aji.john@gmail.com]
> Sent: 25 November 2008 19:36
> To: users@cxf.apache.org
> Subject: jax-rs and jax-ws
>
> I've couple of services written ot for jax-rs requests, how can I easily
> serve them over jax-ws with minimum coding ? I'm using beans.xml for
> configuring , pls see the config below, i'm using cxf 2.1.1
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>  xmlns:cxf="http://cxf.apache.org/core"
>  xsi:schemaLocation="
>  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
>  http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
>  http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
>
>  <import resource="classpath:META-INF/cxf/cxf.xml" />
>  <import
> resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
> />
>  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>  <jaxrs:server id="pQREST" address="/">
>    <jaxrs:serviceBeans>
>      <bean class="xx.yy.services.SessionService" />
>    </jaxrs:serviceBeans>
>    <jaxrs:entityProviders>
>       <bean class="xx.yy.providers.TextXMLProvider" />
>    </jaxrs:entityProviders>
>    <jaxrs:inInterceptors>
>     <bean class="xx.yy.interceptors.SessionInterceptor" />
>    </jaxrs:inInterceptors>
>    <jaxrs:features><cxf:logging /></jaxrs:features>
>  </jaxrs:server>
> </beans>
>

RE: jax-rs and jax-ws

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

Lets assume you'd like to reuse SessionService bean.

Have a look at [1] - it shows one simple way how by adding JAXWS
annotations on SessionService you can make it jaxws-aware.
Next have a look at [2] which shows one example of how you can configure
both jaxws and jaxrs. Note how a service bean is reused by both
jaxws:endpoint and jaxrs:server. At the moment a different endpoint
address is needed for jaxws and jaxrs endpoints.

To have both jaxws and jaxrs play well together consider avoiding
doc-literal-wrapped, unless a given method signature has a single
parameter only.

We'll have quite a few things coming in this area over time. By the way,
if you're using Jetty then you'd be able to use CXF Continuations API
for both JAXWS and JAXRS to do suspended invocations in a
transport-portable way. For ex, you can have continuations over
SOAP-over-HTTP + SOAP-over-JMS plus plain HTTP supported transparently -
sorry can't help saying it even though you didn't ask :-)

Cheers, Sergey

[1]
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apa
che/cxf/systest/jaxrs/BookStoreJaxrsJaxws.java
[2]
http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/resources/ja
xrs_soap_rest/WEB-INF/beans.xml


-----Original Message-----
From: Aji John [mailto:aji.john@gmail.com] 
Sent: 25 November 2008 19:36
To: users@cxf.apache.org
Subject: jax-rs and jax-ws

I've couple of services written ot for jax-rs requests, how can I easily
serve them over jax-ws with minimum coding ? I'm using beans.xml for
configuring , pls see the config below, i'm using cxf 2.1.1

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:jaxrs="http://cxf.apache.org/jaxrs"
  xmlns:cxf="http://cxf.apache.org/core"
  xsi:schemaLocation="
  http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
  http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
  http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import
resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
/>
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

  <jaxrs:server id="pQREST" address="/">
    <jaxrs:serviceBeans>
      <bean class="xx.yy.services.SessionService" />
    </jaxrs:serviceBeans>
    <jaxrs:entityProviders>
       <bean class="xx.yy.providers.TextXMLProvider" />
    </jaxrs:entityProviders>
    <jaxrs:inInterceptors>
     <bean class="xx.yy.interceptors.SessionInterceptor" />
    </jaxrs:inInterceptors>
    <jaxrs:features><cxf:logging /></jaxrs:features>
  </jaxrs:server>
</beans>