Search in sources :

Example 1 with WrapperClassOutInterceptor

use of org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor in project cxf by apache.

the class JaxWsProxyFactoryBean method create.

/**
 * Creates a JAX-WS proxy that can be used to make remote invocations.
 *
 * @return the proxy. You must cast the returned object to the approriate class
 * before making remote calls
 */
@Override
public synchronized Object create() {
    ClassLoaderHolder orig = null;
    try {
        if (getBus() != null) {
            ClassLoader loader = getBus().getExtension(ClassLoader.class);
            if (loader != null) {
                orig = ClassLoaderUtils.setThreadContextClassloader(loader);
            }
        }
        Object obj = super.create();
        Service service = getServiceFactory().getService();
        if (needWrapperClassInterceptor(service.getServiceInfos().get(0))) {
            List<Interceptor<? extends Message>> in = super.getInInterceptors();
            List<Interceptor<? extends Message>> out = super.getOutInterceptors();
            in.add(new WrapperClassInInterceptor());
            in.add(new HolderInInterceptor());
            out.add(new WrapperClassOutInterceptor());
            out.add(new HolderOutInterceptor());
        }
        return obj;
    } finally {
        if (orig != null) {
            orig.reset();
        }
    }
}
Also used : Message(org.apache.cxf.message.Message) HolderInInterceptor(org.apache.cxf.jaxws.interceptors.HolderInInterceptor) HolderOutInterceptor(org.apache.cxf.jaxws.interceptors.HolderOutInterceptor) ClassLoaderHolder(org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder) Service(org.apache.cxf.service.Service) WrapperClassOutInterceptor(org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor) WrapperClassOutInterceptor(org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor) HolderInInterceptor(org.apache.cxf.jaxws.interceptors.HolderInInterceptor) HolderOutInterceptor(org.apache.cxf.jaxws.interceptors.HolderOutInterceptor) Interceptor(org.apache.cxf.interceptor.Interceptor) WrapperClassInInterceptor(org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor) WrapperClassInInterceptor(org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor)

Aggregations

ClassLoaderHolder (org.apache.cxf.common.classloader.ClassLoaderUtils.ClassLoaderHolder)1 Interceptor (org.apache.cxf.interceptor.Interceptor)1 HolderInInterceptor (org.apache.cxf.jaxws.interceptors.HolderInInterceptor)1 HolderOutInterceptor (org.apache.cxf.jaxws.interceptors.HolderOutInterceptor)1 WrapperClassInInterceptor (org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor)1 WrapperClassOutInterceptor (org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor)1 Message (org.apache.cxf.message.Message)1 Service (org.apache.cxf.service.Service)1