Hi Sergey,
Thanks!!! Just to note:
1. OperationInfo opInfo = ex.get(OperationInfo.class); works for SOAP
2. Object nameProperty =
ex.get("org.apache.cxf.resource.operation.name"); works for ReST
Just curious though. I just noticed that if the method is mapped to the
root path (for ReST), e. g. :
@WebService(name="FooService",
targetNamespace="http://foo.com/")
@SOAPBinding(use=Use.LITERAL, style=Style.RPC)
@Consumes("*/xml")
@Produces("text/xml")
@Path("/Foo")
public interface FooService{
@GET
@Path("/")
@WebMethod
@WebResult(name="bar")
public Bar getBar(
@QueryParam("id")
@WebParam(name="id")
long id
);
@GET
@Path("/baz/")
@WebMethod
@WebResult(name="baz")
public Baz getBaz(
@QueryParam("id")
@WebParam(name="id")
long id
);
}
Invoking getBar would result to operationName of "getBar", while
invoking getBaz would result to "FooServiceImpl#getBaz". Im assuming
this is not encountered in SOAP transactions because I am already able
to retrieve the method name using OperationInfo class.
Again, my thanks for the info.
Gabo
On 10/12/2010 9:35 PM, Sergey Beryozkin wrote:
Hi Gabo
On Tue, Oct 12, 2010 at 11:01 AM, Gabo Manuel<kman...@solegysystems.com>wrote:
Hi All,
I am already able to retrieve the endpoint using the following:
Exchange exchange = ...;// retrieved from message
exchange.getEndpoint().getEndpointInfo().getName()
I was wondering if it is possible to retrieve the actual service method
invoked. Am doing all this at a registered out interceptor at
Phase.MARSHAL_ENDING.
A code like this one should give you the name, will work for JAXWS& JAXRS
:
OperationInfo opInfo = ex.get(OperationInfo.class);
String operationName = opInfo == null ? null :
opInfo.getName().getLocalPart();
if (operationName == null) {
Object nameProperty = ex.get("org.apache.cxf.resource.operation.name
");
if (nameProperty != null) {
operationName = nameProperty.toString();
}
}
cheers, Sergey
Thanks in advance.
Gabo