On Thu, Jan 8, 2015 at 8:51 PM, Asok Perera <[email protected]> wrote:

> Hi,
>
> I need to implement JAX WS and JAX RS services to the same endpoint in CXF.
> Here, JAX WS will be used for a POST call, while JAX RS is for a GET.
>
> In the POST call there is a SOAP message as the body and GET call will be
> a normal REST call.
>
> My example cxf-servlet.xml looks like,
>
> * <jaxws:endpoint*
> *            id="DiscoveryService"*
> *            implementor="com.ex.soap.impl.DiscoveryServiceGetImpl"*
> *            address="test/send"/>*
>
> *    <jaxrs:server id="DiscoveryService_rest" address="/test/send">*
> *        <jaxrs:serviceBeans>*
> *            <ref bean="DiscoveryService_rest_bean"/>*
> *        </jaxrs:serviceBeans>*
> *    </jaxrs:server>*
> *    <bean id="DiscoveryService_rest_bean"
> class="com.ex.soap.impl.DiscoveryServiceGetImpl"/> *
>
> This doesn't work for POST, but only works for GET method.
>
> Does anyone know how to achieve this ?
>

You have two alternatives here.

1.) Just write a JAX-RS service and treat SOAP message as POX content, this
is much simple.

2.) Implement RESTful JAX-WS service using JAX-WS Provider API[1].  CXF
already has a sample for this.


[1] - http://docs.oracle.com/javaee/5/api/javax/xml/ws/Provider.html
[2]-  http://cxf.apache.org/docs/rest-with-jax-ws-provider-and-dispatch.html

Thanks !


>
> Note : When the endpoint addresses are different for JAX WS and JAX RS,
> the implementation works fine for both GET and POST. The issue occurs only
> when the endpoint addresses are the same.
>
> BR
>
> *Asok Aravinda Perera*
> Software Engineer
> WSO2, Inc.;http://wso2.com/
> <http://www.google.com/url?q=http%3A%2F%2Fwso2.com%2F&sa=D&sntz=1&usg=AFQjCNGJuLRux6KkJwXKVUCYOtEsNCmIAQ>
> lean.enterprise.middleware
>
> Mobile: +94722241032
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sagara Gunathunga

Senior Technical Lead; WSO2, Inc.;  http://wso2.com
V.P Apache Web Services;    http://ws.apache.org/
Linkedin; http://www.linkedin.com/in/ssagara
Blog ;  http://ssagara.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to