Thanks freeman for the answer,
> You can do it with jaxb databing which is little tricky, by means of > adding jaxb annotation @XmlMimeType("application/octet-stream") on > DataHandler > you can get more details from > > http://www.nabble.com/MTOM-sample-generated-WSDL-with-DataHandler-on-server-t4210895.html Ok, I read that thread. So does this mean that on the client side I will have to deal with a byte[] when specifying a DataHandler on the server side ? Since I am using groovy, I don't forge any wsdl. // create client from DynamicClientFactory and then > use client api which can pass in context > client.invoke(BindingOperationInfo oi, Object[] > params, Map<String, Object> context) > > You can see how to get BindingOperationInfo from operationName in > org.apache.cxf.endpoint.ClientImpl. I was using invoke(String, Object[]) I changed that to QName qname = new QName(client.getEndpoint().getService().getName().getNamespaceURI(), name); BindingOperationInfo op = client.getEndpoint ().getEndpointInfo().getBinding().getOperation(qname); Object[] response = client.invoke(op, objs, context, null); Is that what you meant ? Can the context be set MTOM to true, even if I don't need it for the operation. This will be very difficult for me to determine which operation need MTOM and which don't ? If yes, I now get that exception. It looks I am calling: public Object[] invoke(String operationName, Object... params) rather than: public Object[] invoke(BindingOperationInfo oi, Object[] params, Map<String, Object> context, Exchange exchange) Thoughts ? Regards Guillaume [EMAIL PROTECTED]:~/.eclipse/workspace/groovyws/src/test/test1/client$ groovy client.groovy Found JAXB 2.1 7 sept. 2007 08:56:13 org.apache.cxf.endpoint.dynamic.DynamicClientFactoryaddSchemas INFO: Loading the JAXB 2.1 simple binding for client. 7 sept. 2007 08:56:14 org.apache.cxf.endpoint.dynamic.DynamicClientFactoryoutputDebug INFO: Created classes: com.acme.type.ArrayOfBook, com.acme.type.Book, com.acme.type.ObjectFactory, defaultnamespace.AddBook, defaultnamespace.AddBookResponse, defaultnamespace.FindBook, defaultnamespace.FindBookResponse, defaultnamespace.GetBooks, defaultnamespace.GetBooksResponse, defaultnamespace.ObjectFactory 7 sept. 2007 08:56:16 org.apache.cxf.phase.PhaseInterceptorChain doIntercept INFO: Interceptor has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Marshalling Error: [Ljava.lang.Object; is not known to this context at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall( JAXBEncoderDecoder.java:179) at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java :42) at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts( AbstractOutDatabindingInterceptor.java:84) at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage( BareOutInterceptor.java:68) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept( PhaseInterceptorChain.java:207) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:180) at groovyx.net.ws.WSClient.invokeMethod(WSClient.java:48) at org.codehaus.groovy.runtime.Invoker.invokePogoMethod(Invoker.java :119) at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:81) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod( InvokerHelper.java:85) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN( ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0( ScriptBytecodeAdapter.java:182) at client.run(client.groovy:5) Freeman > > tog wrote: > > Hiya > > > > I tried to enabled MTOM using Aegis binding. I have a method having this > > signature ... > > byte[] getFile(String name) > > > > Accordingly to the doc, I added: > > > > sf = new ServerFactoryBean(); > > > > Map<String,Object> props = new HashMap<String, Object>(); > > props.put("mtom-enabled", Boolean.TRUE); > > sf.setProperties(props); > > > > to enable MTOM. > > > > Looking at the generated WSDL, I got: > > > > <xsd:complexType name="getFileResponse"> > > <xsd:sequence> > > <xsd:element minOccurs="0" name="return" type="xsd:base64Binary"/> > > </xsd:sequence> > > </xsd:complexType> > > > > Is that correct. I thought I should get an > > xmime:expectedContentTypes="application/octet-stream" ? > > > > An other question, I am also using the dynamic client, is there a way to > > enable MTOM on this side ? > > > > Thanks > > > > > > > > > -- Best Regards Guillaume http://cheztog.blogspot.com