Q:

Using Metro, adding a MTOMFeature to client side causes a MIMEParsingException, why?

We have an MTOM-enabled web service that is published with Grails and the Metro 1.0.2 plugin:
@MTOM
@WebService(targetNamespace="http://com.domain")
class TestService {

    @WebMethod
    int uploadFile(@XmlMimeType("application/octet-stream")DataHandler data) {

        data.dataSource.inputStream.eachLine {
            println "reading: -> ${it}"
        }
        return 0
    }
}

Following this tutorial, we set up a Java test-client that looks like this
public class Client {

    public static void main(String[] argv) {

        MTOMFeature feat = new MTOMFeature();
        TestService service = new TestServiceService().getTestServicePort(feat);
        Map<String, Object> ctxt = ((BindingProvider)service).getRequestContext();
        ctxt.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
        service.uploadFile(new DataHandler(new FileDataSource("c:/file.xml")));
    }
}

When I run the client, I get the following error message:

Couldn't create SOAP message due to
  exception:
  org.jvnet.mimepull.MIMEParsingException:
  Missing start boundary

However, when I don't add the MTOMFeature, and just do 
TestService service = new TestServiceService().getTestServicePort(); the files gets uploaded ok. But as I understand it if MTOM is not enabled on both server and client side, the entire file will be kept in memory (and not streamed). So, my questions are

Why do we get that error?
If I don't add the MTOMFeature, will the file still be MTOM-transmitted?

I would be very grateful for any help/tips!

A:

After some research and testing, the answers are:

The error is because grails adds its own filtering, including services. So, by excluding the services from being filtered like this static excludes = ["/services/*"] in UrlMappings.groovy, it works.
No. Without the MTOMFeature the file will just be treated as any other data in the request. That means being stored in the memory, thus causing problems for big files.

