Of course, I typed all that and forgot the most obvious way: Just add a parameter to your method like:
@WebParam(header = true, mode = Mode.OUT) Holder<String> header Dan On Friday 29 February 2008, Daniel Kulp wrote: > OK. This is turning into another FAQ type thing that possibly needs > a sample.... > > There are a couple options open to you: > > First, you need the context injected in: > @Resource > WebServiceContext context; > > 1) Standard JAX-WS API's: throw the value in the WebServiceContext > and in a SoapHandler, use it to modify the SAAJ object model. This > is pure JAXWS and would work on any JAX-WS implementation. The > "problem" is that with the SAAJ model, it breaks streaming and > performance suffers. > > 2) context + CXF interceptor: again, from your impl, throw a value in > the WebServiceContext and then grab that from the message in your > interceptor. You can then call the soapMessage.getHeaders() thing to > get the list of headers and add a Header object to it. > > 3) Context only: no interceptors needed. In you impl do: > > context. > ... build a org.apache.cxf.headers.Header object ... > List<Header> hdrList = (List<Header>)ctx.get(Header.HEADER_LIST)); > hdrList.add(hdr); > > And example of this would be our system test that test this: > http://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/ >java/org/apache/cxf/systest/outofband/header/ > > > 3 is definitely the simplest. No interceptors needed. Nothing > really to configure, etc.... > > > Dan > > On Friday 29 February 2008, Daniel Lipofsky wrote: > > I have a csae where I want to set something in the SOAP > > response header based on what happened in the execution of > > the method implementation. > > > > I suppose I want to extend AbstractSoapInterceptor, but what > > I can't figure out is how to pass a flag from the method > > to the interceptor. I thought about sticking it in the > > ServletRequest attribute map but I don't see a way to access > > that from the interceptor. Any way to do it would be fine. > > > > also is there an example of adding an element to a SOAP header? > > > > Thanks, > > Dan -- J. Daniel Kulp Principal Engineer, IONA [EMAIL PROTECTED] http://www.dankulp.com/blog
