I've got problem to enabling MTOM in mine service. I've followed CXF
documentaion, but it's not working. The first problem is that even I've
annotated my bean with @XmlMimeType("application/octet-stream") the WSDL is
generated without xsd:element
expectedContentTypes="application/octet-stream". 
My bean:
@XmlType
public class MyBean{
        private String param1;
        @XmlMimeType("application/octet-stream")
        private DataHandler fileToTranslate;
...
and service
@WebService
public interface DocumentService {
        @WebResult(name = "docRespons")
        TranslationRespons translate(
                        @WebParam(name = "param") MyBean param);
}
and spring configuration:
        <!-- Document translation service -->
        <jaxws:endpoint id="documentService"
                implementor="#documentServiceImpl" 
address="/documentTranslation">
                <jaxws:serviceFactory> <ref 
bean="jaxws-and-aegis-service-factory" />
                        </jaxws:serviceFactory>
                <jaxws:properties>
                        <entry key="mtom-enabled" value="true" />
                </jaxws:properties>
                <jaxws:inInterceptors>
                                        <bean 
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
                                <constructor-arg>
                                        <map>
                                                <entry key="action" 
value="UsernameToken" />
                                                <entry key="passwordType" 
value="PasswordText" />
                                                <entry key="passwordCallbackRef"
value-ref="serverAuthorizationCallback" />
                                        </map>
                                </constructor-arg>
                        </bean>
                </jaxws:inInterceptors>
        </jaxws:endpoint>

Why it's not working?

I've solved this problem using annotation in service method:
        @WebService
        public interface DocumentService {
                @WebResult(name = "docRespons")
                TranslationRespons translate(
                                @WebParam(name = "param") String dstLanguage,
                                @WebParam(name = "fileToTranslation")
@XmlMimeType("application/octet-stream") DataHandler file);
        }
then WSDL is generate properly with
expectedContentTypes="application/octet-stream".
But when I attempt to test this solution using soapUI I've got exception
when I've enabled MTOM:
2008-08-12 14:10:23 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected element:
{http://www.w3.org/2004/08/xop/include}Include
        at
org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:49)
        at
org.apache.cxf.aegis.databinding.XMLStreamDataReader.read(XMLStreamDataReader.java:34)
...

Caused by: org.apache.cxf.aegis.DatabindingException: Unexpected element:
{http://www.w3.org/2004/08/xop/include}Include
        at
org.apache.cxf.aegis.type.basic.Base64Type.readObject(Base64Type.java:74)
        at
org.apache.cxf.aegis.type.mtom.AbstractXOPType.readObject(AbstractXOPType.java:127)
        at
org.apache.cxf.aegis.AegisXMLStreamDataReader.read(AegisXMLStreamDataReader.java:82)

Without MTOM it's work (really strange). What wrong in my configuration?
-- 
View this message in context: 
http://www.nabble.com/MTOM-%2B-Aegis-tp18943116p18943116.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to