I'm trying to create an endpoint using Grails + CXF. There is a WSDL that is 
provided by a standards body, and I have to use that as the contract for the 
web service.
When I use JAXB to codegen from the WSDL, I get a class that looks like this:

public class ProvideAndRegisterDocumentSetRequestType {
    ...
    protected List<ProvideAndRegisterDocumentSetRequestType.Document> document;

    public static class Document {
        @XmlValue
        protected byte[] value;

        @XmlAttribute(name = "id", required = true)
        @XmlSchemaType(name = "anyURI")
        protected String id;

        ...
    }
    ...
}

Now this document is what gets attached as a mime part.
When I implemented this in a java project, it worked just fine. However when I 
started implementing this in a grails project I started getting an exception on 
calling the webservice.

2012-03-07 11:27:41,464 [http-bio-8080-exec-8] ERROR StackTrace  - Full Stack 
Trace:
org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: 
--MIMEBoundary_4a94e41e3eed5d193a8c2b8ac8fa17bec22927a6b89fb8a1
        at 
org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:66)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at 
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:113)
        at 
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:97)
        at 
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:458)
        at 
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:185)
        at 
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:148)
        at org.grails.cxf.GrailsCXFServlet.invoke(GroovyCXFServlet.groovy)
        at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
        at 
org.grails.cxf.GrailsCXFServlet.handleRequest(GroovyCXFServlet.groovy)
        at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
        at org.grails.cxf.GrailsCXFServlet.doPost(GroovyCXFServlet.groovy)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
        at 
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
        at org.grails.cxf.GrailsCXFServlet.service(GroovyCXFServlet.groovy)

I looked at another post 
(http://www.brimllc.com/2012/01/grails-cxf-web-service-with-mtom-attachments/) 
on Grails + CXF + MTOM that seems to suggest that I should be using DataHandler 
instead of byte[]. However since I'm building a contract-first webservice and 
using codegen, I can't do anything there.

I also implemented the suggestion that I should exclude '/services/*' in my 
UrlMappings to tell grails it shouldn't process what looks like attachments.

Does anyone have any suggestions?

R,
rahul

Reply via email to