You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Morein, Arnie" <Ar...@dps.texas.gov> on 2020/12/07 21:35:18 UTC

CXF InInterceptors Definition Issue

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!

RE: CXF InInterceptors Definition Issue

Posted by "Morein, Arnie" <Ar...@dps.texas.gov>.
No one?

-----Original Message-----
From: Morein, Arnie <Ar...@dps.texas.gov> 
Sent: Monday, December 7, 2020 3:35 PM
To: users@cxf.apache.org
Subject: CXF InInterceptors Definition Issue

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!

CAUTION: This email was received from an EXTERNAL source, use caution when clicking links or opening attachments.

If you believe this to be a malicious and/or phishing email, please send this email as an attachment to SPAM@dps.texas.gov.