Server: Wildfly 20
JDK: 15
CXF: 3.15.5

Hello everyone. I've looked for examples but have yet to find them.

I am consuming a third-party web service in a project. I've created the Java 
stubs and am consuming them.

I have a set of classes that log the SOAP XML (entire envelope) to a table. 

I have plugged them into the class that uses the service client end point thus:

@Inject
private FrdrbCxfSoapInInterceptor frdrbCxfSoapClientInInterceptor;
@Inject
private FrdrbCxfSoapOutInterceptor frdrbCxfSoapClientOutInterceptor;
@Inject
private CxfFaultInInterceptor cxfFaultInInterceptor;
@Inject
private CxfFaultOutInterceptor cxfFaultOutInterceptor;

...

FRSWebServices frsWebServices = new FRSWebServices();
service = frsWebServices.getFRSWebServicesPort();               
        
Client cxfClient = ClientProxy.getClient(service);
// attach the WebServiceMessage intercepter which logs calls to the table
cxfClient.getInInterceptors().add(frdrbCxfSoapClientInInterceptor);
cxfClient.getOutInterceptors().add(frdrbCxfSoapClientOutInterceptor);
// attach the WebServiceMessage intercepter which logs faults to the table
cxfClient.getInFaultInterceptors().add(cxfFaultInInterceptor);
cxfClient.getOutFaultInterceptors().add(cxfFaultOutInterceptor);

The class hierarchy of these loggers is:

public class FrdrbCxfSoapOutInterceptorImpl 
        extends CxfSoapClientInterceptorImpl 
        implements FrdrbCxfSoapOutInterceptor {

public interface FrdrbCxfSoapOutInterceptor extends CxfSoapClientInterceptor {

public abstract class CxfSoapClientInterceptorImpl 
        extends AbstractSoapInterceptor 
        implements CxfSoapClientInterceptor {

public interface CxfSoapClientInterceptor extends 
PhaseInterceptor<SoapMessage>, Serializable {

And everything works as expected.

Now I want to use the same FrdrbCxfSoapOutInterceptorImpl / 
FrdrbCxfSoapInInterceptorImpl classes as the logger for an internal / testing 
instance of the service I am publishing within the same application project.

I have declared the published end point via:

@WebService(
   serviceName = FacialRecognitionBusServiceImpl.SERVICE_NAME,
   name = FacialRecognitionBusServiceImpl.SERVICE_NAME_PORT,
   targetNamespace = FacialRecognitionBusServiceImpl.SERVICE_NAME_SPACE)
@InFaultInterceptors(classes = CxfFaultInInterceptorImpl.class)
@OutFaultInterceptors(classes = CxfFaultOutInterceptorImpl.class)
@InInterceptors(classes = FrdrbCxfSoapInInterceptorImpl.class)
@OutInterceptors(classes = FrdrbCxfSoapOutInterceptorImpl.class)
public class FacialRecognitionBusServiceImpl implements 
FacialRecognitionBusService {

But on the @In/OutInterceptors class entry, I get an error in Eclipse stating:

Type mismatch: cannot convert from Class<FrdrbCxfSoapInInterceptorImpl> to 
Class<? extends Interceptor<? extends Message>>[]

And I cannot figure out why. This part is confusing:

Class<? extends Interceptor<? extends Message>>[]

As Interceptor is an interface reference NOT a class.

So how do I descend the class the way it expects? (I'd like to use the same 
logger as the client but if I need something different, so be it.)

Thanks in advance!

Reply via email to