Thanks Dan

dkulp wrote:
> 
> 
> That's the perfect way to do it.   
> 
> The only issue MIGHT be super(Phase.WRITE);     That's the same phase as
> the 
> SoapOutInterceptor which would be writing the headers.   Thus, if your 
> interceptor happens to run after the SoapOutInterceptor, your header
> wouldn't 
> get written.   I would suggest moving it to an earlier phase (PRE_PROTOCOL 
> maybe) or add a "addBefore(SoapOutInterceptor.class.getName())"
> 
> 
> Dan
> 
> 
> 
> On Fri October 9 2009 6:12:02 am AshAce wrote:
>> I'm trying to add a SOAPHeader to my request using a custom soap header
>> OutInterceptor. I don't want to use ((BindingProvider)
>> proxy).getRequestContext().put(Header.HEADER_LIST, headers);
>> 
>> The class is a such :
>> 
>> public class CustomSoapHeaderOutInterceptor extends
>> AbstractSoapInterceptor
>> {
>> 
>>      public CustomSoapHeaderOutInterceptor() {
>>              super(Phase.WRITE);
>> 
>>      }
>> 
>>      @Override
>>      public void handleMessage(SoapMessage message) throws Fault{
>> 
>> 
>>                      SoapMessage soapMessage = (SoapMessage) message;
>>                      List<Header> list = message.getHeaders();
>> 
>>                      QName q = new QName("http://commons.cxf.learning.com/";,
>>  "HeaderService"); Person person = new Person();
>>                      person.setName("one person");
>>                      JAXBDataBinding dataBinding = null;
>>                              try {
>>                                      dataBinding = new 
>> JAXBDataBinding(person.getClass());
>>                              } catch (JAXBException e1) {
>>                                      e1.printStackTrace();
>>                              }
>> 
>>                              SoapHeader header = new SoapHeader(q,person, 
>> dataBinding);
>>                      list.add(header);
>> 
>>      }
>> }
>> 
>> 
>> This seems to work just fine. I just want to know if this is the correct
>>  way of doing it or do we need to extend some other specific interceptor.
>> 
> 
> -- 
> Daniel Kulp
> [email protected]
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Adding-SOAPHeader-using-an-Interceptor-tp25818665p26064017.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to