title: CXF Client and WS-Addressing attributes
body: <p>I have a webservice that I'm trying to invoke with the following <strong>client-side</strong> code:</p>
  
  <pre><code>    import com.test.wsdl.CxfAdd;
      import com.test.wsdl.CxfAddService;
  
      import java.util.Map;
  
      import javax.xml.ws.BindingProvider;
  
      import org.apache.cxf.ws.addressing.AddressingProperties;
      import org.apache.cxf.ws.addressing.AttributedURIType;
      import org.apache.cxf.ws.addressing.EndpointReferenceType;
      import org.apache.cxf.ws.addressing.JAXWSAConstants;
  
      public class Main {
  
          public static void main(String[] args) {
  
              CxfAddService service = new CxfAddService();
              CxfAdd client = service.getCxfAddPort();
  
              Map&lt;String, Object&gt; requestContext = ((BindingProvider)client).getRequestContext();
  
              AddressingProperties maps = new AddressingProperties();
              EndpointReferenceType ref = new EndpointReferenceType();
              AttributedURIType add = new AttributedURIType();
  
              add.setValue("http://www.w3.org/2005/08/addressing/anonymous");
              ref.setAddress(add);
              maps.setReplyTo(ref);
              maps.setFaultTo(ref);
  
              requestContext.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps);
  
              client.myMethodOneWay("Input message");
          }
      }
  </code></pre>
  
  <p>On the <strong>server-side</strong> (Tomcat), the webservice is implemented as the following:</p>
  
  <p><strong>CxfAdd.java:</strong></p>
  
  <pre><code>    package com.test.ws;
  
      import javax.jws.Oneway;
      import javax.jws.WebResult;
      import javax.jws.WebService;
      import javax.xml.ws.soap.Addressing;
  
      @WebService(targetNamespace = "http://test.com/wsdl")
      @Addressing(enabled = true, required = true)
      public interface CxfAdd {
  
          @WebResult(name = "response")
          public abstract String myMethod(String message);
  
          @WebResult(name="response")
          @Oneway
          public void myMethodOneWay(String message);
      }
  </code></pre>
  
  <p><strong>CxfAddImpl.java:</strong></p>
  
  <pre><code>    package com.test.ws;
  
      import javax.annotation.Resource;
      import javax.jws.Oneway;
      import javax.jws.WebService;
      import javax.xml.ws.WebServiceContext;
      import javax.xml.ws.soap.Addressing;
  
      @WebService
      @Addressing
      public class CxfAddImpl implements CxfAdd {
  
          @Resource
          WebServiceContext webServiceContext;
  
          public String myMethod(String message) {
              System.out.println("Invoking sayHello in " + getClass());
              return "Hello " + message;
          }
  
          @Oneway
          public void myMethodOneWay(String message) {
              // TODO Auto-generated method stub      
          }
      }
  </code></pre>
  
  <p>However, when I run the client-side code, at the server-side I get the following error:</p>
  
  <pre><code>INFO: Inbound Message
  ----------------------------
  ID: 46
  Address: http://localhost:8080/CxfAddressingServer/services/cxfadd
  Encoding: UTF-8
  Http-Method: POST
  Content-Type: text/xml; charset=UTF-8
  Headers: {Accept=[*/*], cache-control=[no-cache], connection=[keep-alive], Content-Length=[211], content-type=[text/xml; charset=UTF-8], host=[localhost:8080], pragma=[no-cache], SOAPAction=[""], user-agent=[Apache CXF 3.1.3]}
  Payload: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns2:myMethodOneWay xmlns:ns2="http://test.com/wsdl"&gt;&lt;arg0&gt;Input message&lt;/arg0&gt;&lt;/ns2:myMethodOneWay&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  --------------------------------------
  Out 30, 2015 7:18:56 PM org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs
  WARNING: WS-Addressing - failed to retrieve Message Addressing Properties from context
  </code></pre>
  
  <p>It seems that I'm not sending the ws-addressing attributes, can anyone help me figure out what's wrong or missing in my code? Thank you.</p>