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

Reply via email to