Hi,

Thanks Sagara !
I will check those CXF examples.

After bit of search, I could find another solution for this.
This specific implementation has apache server infront of these two
services, as there is a Proxypass functionality.
So I implemented these JAX WS and JAX RS services with 'different' endpoint
addresses, and added two RewriteRules to httpd.conf, such that if the
client makes a call to the given single endpoint (either GET or POST), the
RewriteRules check whether the call is GET or POST,
then routes it to relevant endpoint (JAX WS or JAX RS).

*RewriteEngine On*
*RewriteCond %{REQUEST_METHOD} ^(POST)$*
*RewriteRule ^/EnrollmentServer/Discovery.svc
http://localhost:9763/testsoap/test/send
<http://localhost:9763/testsoap/test/send> [P,L]*

*RewriteCond %{REQUEST_METHOD} ^(GET)$*
*RewriteRule ^/EnrollmentServer/Discovery.svc
http://localhost:9763/testsoap/test/send2
<http://localhost:9763/testsoap/test/send2> [P,L]*

This worked as expected,
But I will check what you have suggested as well.

Thanks again, and any comment on this will be really helpful.

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

On Thu, Jan 8, 2015 at 9:38 PM, Sagara Gunathunga <[email protected]> wrote:

>
>
> 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