Great. Thank you for the pointers. I am able to get the 'SoapMessage' reference and call getHeaders, get the List, etc, etc. My interceptor is in the PRE_STREAM phase and I am also experimenting in the MARSHAL phase as well.
However, I cannot seem to figure out how to bind my string literal "id" to the actual header element. Is there a utility or an easy way to create a 'Header' instance? I am using the constructor, but not 100% sure what I need to pass for the DataBinding. Here is my code: QName qname = new QName(message.getVersion().getHeader()); Object obj = "12345-67890"; DataBinding db = ?; // where can I get this? message.getHeaders().add(*new* Header(qname, obj, db)); I really appreciate your help. Arik. On Fri, Oct 30, 2009 at 7:06 AM, Daniel Kulp <dk...@apache.org> wrote: > On Thu October 29 2009 9:07:16 pm Arik Gorelik wrote: > > Basically, I am wondering if it is possible to set something in the soap > > response header in the interceptor (not in the service method > > implementation) during PRE_STREAM phase. > > Well, yea, but in an interceptor you have two options: > > 1) Exactly the same way as in (4). > message.get(Header.HEADER_LIST) > returns the List<Header> (or null in which case you create a List<Header> > and > add it) > > 2) If you interceptor is Interceptor<SoapMessage> or if you cast the passed > in > Message to a SoapMessage, there is a getHeaders() call on soapmessage. > > > Dan > > > > > > On Thu, Oct 29, 2009 at 2:09 PM, Arik Gorelik <arikg...@gmail.com> > wrote: > > > Seems like if there is a heavy dependency on CXF in the project (as in > my > > > case), the best option is this one: > > > > > > 4. CXF proprietary way: In the context > > > (BindingProvider.getRequestContext() on client, WebServiceContext on > > > server), you can add a > > > List<org.apache.cxf.headers.Header> with the key Header.HEADER_LIST. > The > > > headers in the list are streamed at the appropriate time to the wire > > > according to the databinding object found in the Header object. Like > > > option 1, this doesn't require changes to wsdl or method signatures. > > > However, it's much faster as it doesn't break streaming and the memory > > > overhead is less. > > > > > > Let's say I want to return an ID in the header with every response, is > > > that something I can do in the PRE_STREAM interceptor on the OUT scope? > > > > > > Arik. > > > > > > On Thu, Oct 29, 2009 at 10:48 AM, Daniel Kulp <dk...@apache.org> > wrote: > > >> On Thu October 29 2009 1:01:20 pm Arik Gorelik wrote: > > >> > Hello, > > >> > > > >> > I cannot seem to find any example of how to include/set > headers/values > > >> > > >> in > > >> > > >> > the SOAP response. Is there a CXF example on that? I can think of > few > > >> > > >> ways > > >> > > >> > to do this, but was wondering if anyone has a best practice sample. > > >> > > >> See the faq: > > >> > > >> http://cxf.apache.org/faq.html > > >> > > >> > > >> > > >> -- > > >> Daniel Kulp > > >> dk...@apache.org > > >> http://www.dankulp.com/blog > > > > -- > Daniel Kulp > dk...@apache.org > http://www.dankulp.com/blog >