code: public void useXopAttachmentServiceWithWebClient() throws Exception {
  
          final String serviceURI = "http://localhost:" + port + "/services/attachments/xop";
          
          JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean();
          factoryBean.setAddress(serviceURI);
          factoryBean.setProperties(Collections.singletonMap(org.apache.cxf.message.Message.MTOM_ENABLED, 
                                                      (Object)"true"));
          WebClient client = factoryBean.createWebClient();
          WebClient.getConfig(client).getRequestContext().put("support.type.as.multipart", 
              "true"); 
          client.type("multipart/related").accept("multipart/related");
          
          XopBean xop = createXopBean();
          
          System.out.println();
          System.out.println("Posting a XOP attachment with a WebClient");
          
          XopBean xopResponse = client.post(xop, XopBean.class);
          
          verifyXopResponse(xop, xopResponse);
      }
docs: Writes and reads the XOP attachment using a CXF JAX-RS WebClient.
  Note that WebClient is created with the help of JAXRSClientFactoryBean.
  JAXRSClientFactoryBean can be used when neither of the WebClient factory
  methods is appropriate. For example, in this case, an "mtom-enabled"
  property is set on the factory bean first.
  
  
  @throws Exception