Hi Daniel, I have testes your suggestion:
----------------------------------------------- Endpoint ep = Endpoint.create(obj); ((EndpointImpl)ep).setImplementorClass(CafServiceImpl.class); ep.publish(address); ---------------------------------------- and it works like a charm! Many thanks Daniel. But I think CXF should fix the problem to retrieves the JAX-WS annotations because you have several mean to retrieve annotation (class.getAnnotations, loop for super class to retrieve annotations...) and have an AnnotationHelper class used to retrieves annotations. Anyway many thanks Daniel! Regards Angelo Le 29 mars 2012 23:13, Daniel Kulp <[email protected]> a écrit : > > Well, couple thoughts: > > * If you want to submit a patch, a simple patch that would search up the > parents like it does for @WebService would be useful. Likely fairly > simple. > > * If you want something that would work right now, instead of using > Endpoint.publish(...), you could split into create and publish and set some > stuff in between via a cast to CXF's impl: > > Endpoint ep = Endpoint.create(obj); > ((EndpointImpl)ep).setImplementorClass(CafServiceImpl.class); > ep.publish(address); > > That way CXF would use the proper class right at the start. > > Dan > > > > On Wednesday, March 28, 2012 04:13:30 PM Angelo zerr wrote: > > Hi CXF Team, > > > > I'm using JAX-WS without Spring (with Endpoint.publish()) and I would > like > > use SOAP 1.2 instead of SOAP 1.1. > > I have added the @BindingType like this: > > > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > @WebService(serviceName = "CafServiceService", portName = "CafService", > > targetNamespace = "http://sidoc.intra.cnaf/", endpointInterface = > > "cnaf.sidoc.dgp.ws.server.caf.CafService") > > @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) > > public class CafServiceImpl .... > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > > > And my problem is that CXF ignores the @BindingType. I have debugged CXF > > and I have found the problem : my problem is that I publish a Javassist > > Proxy which wraps my > > CafServiceImpl class instead of publishing directly the CafServiceImpl > > class. > > > > I have debugged CXF and when I go to the > > JaxWsImplementorInfo#getBindingType() : > > > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ public > > String getBindingType() { > > BindingType bType = > > implementorClass.getAnnotation(BindingType.class); > > if (bType != null) { > > return bType.value(); > > } > > return SOAPBinding.SOAP11HTTP_BINDING; > > } > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > > > BindingType is null. Why? because implementorClass is NOT > > CafServiceImpl.class but Javassist Proxy > (CafServiceImpl_$$_javassist_56). > > I'm searching why @WebService works and why @BindingType doesn't work. > > The response is that @WebService is retrieved by searching on super class > > of Javassist Proxy but for @BindingType implementorClass is used and use > > the ClassHelper#getRealClass(Object o) : > > > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > protected Class getRealClassInternal(Object o) { > > return o.getClass(); > > } > > > > public static Class getRealClass(Object o) { > > return HELPER.getRealClassInternal(o); > > } > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > > > The problem is o.getClass(). I have noticed that there is ClassHelper > > which tries to instanciate SpringAopClassHelper (which I suppose which > > resolves problem when Spring AOP is used) : > > > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ public > > class ClassHelper { > > static final ClassHelper HELPER; > > static { > > ClassHelper theHelper = null; > > try { > > theHelper = new SpringAopClassHelper(); > > } catch (Throwable ex) { > > theHelper = new ClassHelper(); > > } > > HELPER = theHelper; > > } > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > > > So I think to resolve my problem is to initialize my own ClassHelper > > (JavassistClassHelper). > > > > To do that, I have 2 suggestions : > > > > 1) ugly mean : add a setter ClassHelper > > > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ public > > void static setClassHelper(ClassHelper helper) { > > HELPER=helper; > > } > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > > -------------------------------------------------------------------------- > > ------------------------------------------------------------------ > > > > 2) Use SPI Provider to customize the Classhelper that we wish use it > (just > > set in my project a file > > services/META-INF/org.apache.cxf.common.util.ClassHelper wich contains > the > > implementation > > of ClassHelper that I wish to use.) > > > > What do you think about that? > > > > Many thanks for your help. > > > > Regards Angelo > -- > Daniel Kulp > [email protected] - http://dankulp.com/blog > Talend Community Coder - http://coders.talend.com > >
