Issues in usage of @XmlJavaTypeAdapter annotation in service methods --------------------------------------------------------------------
Key: TUSCANY-2840 URL: https://issues.apache.org/jira/browse/TUSCANY-2840 Project: Tuscany Issue Type: Bug Components: Java SCA Data Binding Runtime Affects Versions: Java-SCA-Next Environment: Windows XP, SP2, IBM JDK 1.5 Reporter: Ramkumar Ramalingam Assignee: Ramkumar Ramalingam Fix For: Java-SCA-Next Here I like to talk about the options to support org.apache.axiom.om.OMElement datatype in our databinding scope.... Since OMElement is an interface, the JAXB runtime throws the following exception.... org.apache.axiom.om.OMElement is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.apache.axiom.om.OMElement at protected org.apache.axiom.om.OMElement org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.jaxws.UploadOMElementFile.arg0 at org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.jaxws.UploadOMElementFile JAXB recommends to use an XMLAdapter to solve this issue, by creating an XMLAdapter for your interfaces (OMElement) and by using @XmlJavaTypeAdapter in the service method as shown below. @XmlJavaTypeAdapter(value=OMElementXmlAdapter.class, type=OMElement.class) public String uploadOMElementFile(OMElement attachment) throws Exception; Using @XmlJavaTypeAdapter in the service method, throws the following exception..... java.lang.IllegalArgumentException: value class org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.OMElementXmlAdapter at org.objectweb.asm.ClassWriter.a(Unknown Source) at org.objectweb.asm.AnnotationWriter.visit(Unknown Source) at org.apache.tuscany.sca.interfacedef.java.jaxws.BaseBeanGenerator.declareField(BaseBeanGenerator.java:250) at org.apache.tuscany.sca.interfacedef.java.jaxws.BaseBeanGenerator.declareProperty(BaseBeanGenerator.java:195) at org.apache.tuscany.sca.interfacedef.java.jaxws.BaseBeanGenerator.defineClass(BaseBeanGenerator.java:153) at org.apache.tuscany.sca.interfacedef.java.jaxws.BaseBeanGenerator.generate(BaseBeanGenerator.java:437) at org.apache.tuscany.sca.interfacedef.java.jaxws.WrapperBeanGenerator.generateResponseWrapper(WrapperBeanGenerator.java:190) at org.apache.tuscany.sca.interfacedef.java.jaxws.GeneratedDataTypeImpl.getPhysical(GeneratedDataTypeImpl.java:101) at org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.findClasses(JAXBContextHelper.java:230) at org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBContext(JAXBContextHelper.java:210) at org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBContext(JAXBContextHelper.java:89) at org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement.transform(JAXB2OMElement.java:52) at org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement.transform(JAXB2OMElement.java:40) at org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint$LazyPullTransformer.transform(DefaultTransformerExtensionPoint.java:200) at org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:81) at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:190) at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:1) at org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:81) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.transform(DataTransformationInterceptor.java:208) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:97) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:310) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:163) at $Proxy19.uploadOMElementFile(Unknown Source) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.