private <T> T createPort(QName serviceName, QName portName,
Class<T> serviceEndpointInterface, boolean enableMTOM)
throws Exception {
Bus bus = BusFactory.getDefaultBus();
ReflectionServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
serviceFactory.setBus(bus);
serviceFactory.setServiceName(serviceName);
serviceFactory.setServiceClass(serviceEndpointInterface);
serviceFactory.setWsdlURL(getClass().getResource("/wsdl/mtom_xop.wsdl"));
Service service = serviceFactory.create();
EndpointInfo ei = service.getEndpointInfo(portName);
JaxWsEndpointImpl jaxwsEndpoint = new JaxWsEndpointImpl(bus, service,
ei);
SOAPBinding jaxWsSoapBinding = new SOAPBindingImpl(ei.getBinding());
jaxWsSoapBinding.setMTOMEnabled(enableMTOM);