WebServiceContext is a JAX-WS specific thing and thus only works with the JAX-WS frontend, not the simple frontend. You MIGHT be able to get it to work with the simple frontend if you use the JAX-WS invoker, but I'm not really sure if that works at all. Haven't tried it.

Couple options:
1) Add an "Exchange exc" parameter as the last parameter to the method. The simple frontend will see that and pass the full exchange in. 2) Create an Interceptor that would store the exchange or message in a public ThreadLocal someplace that your impl could get.


Dan




On May 12, 2008, at 8:52 AM, andre wrote:

Hi,

I'm using cxf's simple server frontend and I need the message context within the endpoint. WebServiceContext is injected, but invoking "getMessageContext()" from it returns null. There's a similar post addressing this issue, but in that case it seems it was a problem with the user's custom invoker. In my case, there's no custom invoker and I'm using Windows Vista. Is there another approach to obtain the message context? Can be an operating system related issue?

Sample code:

@WebService
public class FooImpl implements Foo {
  @Resource
  private WebServiceContext webContext;

  public void fooIt() {
MessageContext messageContext = this.webContext.getMessageContext(); // messageContext returns null
      // ...do something with messageContext
  }
}

Thanks in advance,
Andre



---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to