I am moving this thread from dev@cxf to users@cxf.

One approach to remove the replyTo element is to use the transform
feature at the particular endpoint or at the bus where you want to
remove the header for the outgoing messages.

You can take a look at this example:
http://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Droppingoutputandinputelements

For your case, that means you set the property as
<entry key="{http://www.w3.org/2005/08/addressing}ReplyTo"; value=""/>

regards, aki

2013/7/16 Rodel <[email protected]>:
> I've been searching for ways to remove the WSA Addressing Property ReplyTo
> from the Client Outbound as the  WebService does not require ReplyTo for
> synchronous messages.
>
> I've created outbound interceptors (from simple to saaj) and tried many
> Phases but to no avail. Any help will be very much appreciated.
>
> Simple Outbound Interceptor:
>
> public class GP10ErrataWSASoapOutInterceptor extends BaseWSSoapInterceptor{
>
>         public GP10ErrataWSASoapOutInterceptor() {
>                 super(Phase.WRITE);
>                 this.addBefore(SoapOutInterceptor.class.getName());
>         }
>
>         private static final Logger LOGGER = Logger
>                         
> .getLogger(GP10ErrataWSASoapOutInterceptor.class.getName());
>
>         private AddressingPropertiesImpl maps;
>
>         @Override
>         protected void processMessage(SoapMessage message) {
>                 LOGGER.debug("<<<<<<<< processMessage() START >>>>>>>>");
>                 maps = getMAPs(message, true, true);
>                 List <Header> list = new 
> ArrayList<Header>(message.getHeaders());
>                 List <Header> origList = message.getHeaders();
>                 if (maps!=null && maps.getReplyTo() != null &&
> maps.getReplyTo().getAddress() != null
>                                 && maps.getReplyTo().getAddress().getValue() 
> != null) {
>                         String address = 
> maps.getReplyTo().getAddress().getValue();
>                         // if reply to contains "anonymous", it means the 
> reply to was not set
>                         boolean isAnonymous = address.contains("/anonymous") 
> ||
> address.contains("/none");
>                         LOGGER.debug("<<<<<<<< isAnonymous : "+isAnonymous);
>
>                         if (isAnonymous) {
>                                 LOGGER.debug("<<<<<<<< isAnonymous >>>>>>>>");
>                                 Header replyTo = null;
>                                 for (Header header : list) {
>                                         if 
> (header.getName().getLocalPart().equals("ReplyTo"))
>                                                 replyTo = header;
>                                 }
>                                 list.remove(replyTo);
>
>                                 for (Header h: list)
>                                         System.out.println(h.getName());
>
>                                 // do something silly... enforced removal of
> all list and setting in the new list
>                                 message.getHeaders().removeAll(origList);
>                                 message.getHeaders().addAll(list);
>                         }
>                 }
>
>                 LOGGER.debug(">>>>>>>> processMessage() ENDED <<<<<<<<");
>         }
> }
>
>
> public abstract class BaseWSSoapInterceptor extends AbstractSoapInterceptor{
>
>
>         private static final Logger LOGGER = Logger
>                         .getLogger(BaseWSSoapInterceptor.class.getName());
>
>         public BaseWSSoapInterceptor(String phase)      {
>                 super(phase);
>         }
>
>         public void handleMessage(SoapMessage message) throws Fault {
>                 LOGGER.debug("<<<<<<<< handleMessage() START >>>>>>>>");
>                 processMessage(message);
>                 LOGGER.debug(">>>>>>>> handleMessage() ENDED <<<<<<<<");
>         }
>
>         /**
>          * This method needs to be overriden by the child class to do specific
> processing
>          * @param message
>          */
>         protected abstract void processMessage(SoapMessage message);
>
>         protected AddressingPropertiesImpl getMAPs(SoapMessage message,
>                         boolean isProviderContext, boolean isOutbound) {
>                 AddressingPropertiesImpl maps = null;
>                 maps = ContextUtils
>                                 .retrieveMAPs(message, isProviderContext, 
> isOutbound);
>                 if (maps!=null)
>                         LOGGER.info("MAPs retrieved from message {" + 
> maps.toString() + "}");
>                 else LOGGER.info("No WS Addressing SOAP Header Found...");
>                 return maps;
>         }
>
> }
>
>
>
>
>
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Removing-Addressing-Property-ReplyTo-tp5730963.html
> Sent from the cxf-dev mailing list archive at Nabble.com.

Reply via email to