Hi Tony:

> I am calling it during an active invocation on the server side (not sure
> how you would call it outside of an active invocation there?).  I
> basically have a method in my service like this:
>
> public String getFile( String ) {
>     // NullPointerException thrown here because
> AxisEngine.getCurrentMessageContext() is null.
>     Message rspmsg =
> AxisEngine.getCurrentMessageContext().getResponseMessage();
>
>     // File attachment code here.
>
>     return someString;
> }
>
> Shouldn't there be an active invocation context in this case?

Yes, there definitely should.  I would try starting with a fresh "framework"
service that has no code in it, confirm that you are in fact getting valid
MessageContexts:

public class MyService {
  public void checkMC() {
      MessageContext mc = MessageContext.getCurrentContext();
      // Should not be null
      System.out.println("Got MessageContext : " + mc);
  }
}

and then progressively build up pieces to your service until you see the
problem.  You didn't spawn off another thread, by any chance, did you?  That
would cause the behaviour you're seeing, since the active MC is kept in
thread-local storage....

--Glen

Reply via email to