cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liw <pattiew...@yahoo.com>
Subject RE: How to get the method info for rest service
Date Tue, 18 Aug 2009 06:13:12 GMT

Hi Eamonn,

Yes, it helps. I am able to get it work for REST service.

Thanks a lot,

Li




Eamonn Dwyer-2 wrote:
> 
> 
> Hi Li
> I think the following might help you to get the operation
> 
> OperationResourceInfo operationResourceInfo =
> ex.get(OperationResourceInfo.class);
> String operation = operationResourceInfo.getMethodToInvoke();
> 
> I think then to get the JAX rs service you need to use
> 
> Endpoint endpoint = ex.get(Endpoint.class);
> Service service = endpoint.getService(); 
> 
> 
> Hope this helps
> Eamonn
> 
>> Date: Fri, 14 Aug 2009 16:29:47 -0700
>> From: pattiewang@yahoo.com
>> To: users@cxf.apache.org
>> Subject: How to get the method info for rest service
>> 
>> 
>> Hi,
>> 
>> We are working on a project that exposes both soap and rest web services
>> for
>> the same underlying interface and impl java classes
>> 
>> In the interface class, we define some annotations at both class and
>> interface level, which we need to apply business logic based on the
>> annotations.
>> 
>> e.g.
>> 
>> @WSMTMethod(productionGroup="Internal")
>>   public SampleCalcResponse calculate(SampleCalcParams calcParams )
>> throws
>> AppException;
>> 	
>> 
>> For the soap, we have the following code to get the Method used for the
>> soap
>> request.
>> 
>>    private Method getMethod(Message message) {
>> 	    	Exchange ex = message.getExchange();
>> 	    	BindingOperationInfo op =
>> (BindingOperationInfo)ex.get(BindingOperationInfo.class);
>> 	    	if(op == null)
>> 	    		return null; //found its null for jaxrs
>> 	    	Service service = ex.get(Service.class);
>> 	    	MethodDispatcher md =
>> (MethodDispatcher)service.get(MethodDispatcher.class.getName());
>> 	        return md.getMethod(op);
>> 	    }
>> 
>> However, this piece of code doesn't work for rest. For rest,
>> (BindingOperationInfo)ex.get(BindingOperationInfo.class) returns null.
>> 
>> 
>> How to get a handler of the underlying interface and impl class/methods
>> using jaxrs? If BindingOperationInfo is only for soap, what's the
>> equivalent
>> class for rest?
>> 
>> Thanks in advance,
>> 
>> Li
>> 
>> 
>> 
>> 
>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-get-the-method-info-for-rest-service-tp24980139p24980139.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> _________________________________________________________________
> See all the ways you can stay connected to friends and family
> http://www.microsoft.com/windows/windowslive/default.aspx
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-the-method-info-for-rest-service-tp24980139p25019078.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message