views:

139

answers:

1

Using Grails and CXF, I have published a small web service that looks like this

class TestService {

    static expose=['cxf']

    int pushData(int id, DataHandler data) {

        //receives data for a specific ID,
        return 1
    }
}

The thing is that I now would like to enable MTOM for the transfer of the DataHandler-data. Normally with Groovy and CXF (or JAX-WS) I'd publish TestService as an Endpoint

Endpoint ep = Endpoint.publish("http://localhost:9000/test", new TestService())
SOAPBinding binding = (SOAPBinding)ep.getBinding();
binding.setMTOMEnabled(true);

And all's done.

Now that I use Grails to do my publishing I can't figure out how to get the Endpoint. Does anyone know how this could be accomplished?

A: 

Let's assume that the service interface looks like this

@MTOM
@WebService(targetNamespace="http://soap.services.website.com/", 
        endpointInterface="com.armorize.web.services.ServiceInterface")
public interface ServiceInterface

  int uploadData(@XmlMimeType("application/octet-stream") DataHandler code) ;

The attributes of the endpoint can be specified in the cxf-servlet.xml . With an implementing service called ServiceImpl, you need to add the following specifications

  <jaxws:endpoint id="endpointID"
        implementor="com.website.web.services.ServiceImpl" address="/test">

        <jaxws:properties>
            <entry key="mtom-enabled" value="true" />
            <entry key="mtom-threshold" value="0" />
        </jaxws:properties>
Lars Andren