I did some research on this. There is not a lot of material available on the internet for this. However i got lucky. Those who are facing similar problems like me can use this method :
protected String getMethodName(MessageContext mc)
{
String operationName = null;
try
{
SOAPMessageContext messageContext = (SOAPMessageContext) mc;
// assume the operation name is the first element
// after SOAP:Body element
Iterator i = messageContext.
getMessage().getSOAPPart().getEnvelope().getBody().getChildElements();
while ( i.hasNext() )
{
Object obj = i.next();
if(obj instanceof SOAPElement)
{
SOAPElement e = (SOAPElement) obj;
operationName = e.getElementName().getLocalName();
break;
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
return operationName;
}
This method takes the message context object and iterates through the whole soap envelope to get the operation name.
Hope this helps some of the folks.