axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Colussi <Kevin.Colu...@volvo.com>
Subject Re: really stumped... messageContext.getOperation() = null
Date Tue, 18 Jan 2005 15:42:25 GMT
This is just a follow up on what I found....

The OperationDesc in the MessageContext will be null when:

1) The deployed interface/impl has over loaded methods.
2) When the client envelope is well formed (ie SAX parser is
	happy) but the method the client is trying to invoke
	doesn't exist.

So I did find a problem where the method was over loaded and
that fixed one of my problem.... However, I still had intermittent
problems w/ the MessageContext.getOperation() returning null for
some calls... So i figured out this and it seems to be working...

=========== snip =====================================
String operationName = "";
  try {
     Iterator i = messageContext.getCurrentMessage().
	getSOAPEnvelope().getBody().getChildElements();
     while (i.hasNext()) {
	try {
   	  RPCElement o= (RPCElement) i.next();
	  operationName = o.getMethodName();
	  break;
	} catch (ClassCastException e) {
         }
     }
     if (operationName.equals("")) {
	throw new
	  Exception("Invalid request.  Only RPC is supported.");
     }
  } catch (NullPointerException ne) {
	throw new Exception(
	"Problem getting child elements: " + ne.toString());
  } catch (SOAPException e) {
	throw new CallerIdException(e.toString());
  }
  System.out.println("operationName = " + operationName);
=========== snip =====================================

Hope this helps someone else...  I would still like to see
how others are getting the calling method from the MessageContext
object...

Cheers,
-- Kevin

Kevin Colussi wrote:
> Hello,
> 
> I have been running Axis 1.1 for a while... With a handler
> that calls messageContext.getOperation() to log the client
> method request... The service runs in a WAS 5.1 env on AIX...
> 
> Out of the blue I start getting null pointers from the
> handler... I traces it down this line:
> 
> public void invoke(MessageContext messageContext) throws AxisFault {
>     ............
>     String name = messageContext.getOperation().getName();
>     ............
> }
> 
> So I started searching.... Sure enough the getOperation() returns
> null from an Axis test client and JMeter script... In the debugger
> I can see the AxisServer.class and the msgContext in this line:
> 
> setCurrentMessageContext(msgContext);
> 
> whose operation is null.... huh?  There are other services deployed
> in this same container that use the same handler just fine.....
> 
> The Axis JavaDoc says it's ok for the messageContext.getOperation() to
> return null....  If that is the case how does the Axis servlet know
> which method to call in the service class implementation?  Should I be
> using something other than messageContext.getOperation() to get the
> method the client is calling?
> 
> Thanks a ton for any advise....
> -- Kevin
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Colussi
Volvo IT North America
Senior Web Developer
Telephone: 336-393-2178
Fax: 336-393-2300
E-mail: kevin.colussi@volvo.com
Office Hours:  6:00am - 3:00pm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mime
View raw message