Hi, No, you can't so far. Basically cxf is a jax-ws implementation, and per jax-ws spec, in section 5.1
5.1 javax.xml.ws.Provider ♦ Conformance (Provider support required): An implementation MUST support Provider<Source> in payload mode with all the predefined bindings. It MUST also support Provider<SOAPMessage> in message mode in conjunction with the predefined SOAP bindings and Provider<javax.activation- .DataSource> in message mode in conjunction with the predefined HTTP binding. So cxf exactly follow the spec. Freeman ------------- Freeman Fang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://fusesource.com | http://www.redhat.com/ Twitter: freemanfang Blog: http://freemanfang.blogspot.com http://blog.sina.com.cn/u/1473905042 weibo: http://weibo.com/u/1473905042 On 2012-9-28, at 下午3:09, Jinhua Wang wrote: > Hello > > I have a provider migrating problem from axis2 to cxf(2.6.2). > The exception is about java.lang.*ClassCastException*: > javax.xml.transform.dom.*DOMSource* *incompatible *with java.lang.*String* > > *web service:* > @BindingType(value=SOAPBinding.SOAP11HTTP_BINDING) > @ServiceMode(value=Service.Mode.*PAYLOAD*) > @*WebServiceProvider*(targetNamespace="http://sample.org/test", > serviceName="TestService", portName="TestServicePort", > wsdlLocation="WEB-INF/wsdl/TestService.wsdl") > public class StringProvider* implements Provider<String>* > {xxxxxx } > > *StackTrace:* > org.apache.cxf.interceptor.Fault: javax.xml.transform.dom.DOMSource > incompatible with java.lang.String > at > org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) > at > org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213) > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) > at > org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) > at > org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:64) > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262) > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:211) > > *Caused by: java.lang.ClassCastException: javax.xml.transform.dom.DOMSource > incompatible with java.lang.String* > at sample.server.provider.String12Provider.invoke(String12Provider.java:26) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:600) > at > org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) > > *Releated class:* > org.apache.cxf.service.invoker.AbstractInvoker.*performInvocation*(Exchange, > Object, Method, Object[]) > > > After googling, I found the provider service page, > http://cxf.apache.org/docs/provider-services.html > Three type of classes are mentioned in the Data Types section. > > Since Provider<T> interface is generic, can we use other concrete class > besides the above three inheritance chain types(Source, SOAPMessage, > DataSource) for implementation? > > > Best Regards
