private void setupForTest(boolean enableClientMTOM) throws Exception { AegisDatabinding aegisBinding = new AegisDatabinding(); aegisBinding.setMtomEnabled(enableClientMTOM); ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean(); proxyFac.setDataBinding(aegisBinding); proxyFac.setAddress("http://localhost:" + PORT + "/mtom"); JaxWsProxyFactoryBean jaxwsFac = new JaxWsProxyFactoryBean(); jaxwsFac.setDataBinding(new AegisDatabinding()); jaxwsFac.setAddress("http://localhost:" + PORT + "/jaxWsMtom"); Map<String, Object> props = new HashMap<>(); if (enableClientMTOM) { props.put("mtom-enabled", Boolean.TRUE); } proxyFac.setProperties(props); client = proxyFac.create(MtomTestService.class); jaxwsClient = jaxwsFac.create(MtomTestService.class); impl = (MtomTestImpl)applicationContext.getBean("mtomImpl"); }