3

My problem is quite the same as is asked in this other question: "How to use Spring Autowired in a custom cxf interceptor?". The valid response there recommends to configure the endpoint through context xml:

<jaxws:endpoint id="myWebService" address="/MyWebService">
    <jaxws:inInterceptors>
        <ref bean="myInInterceptor" />
    </jaxws:inInterceptors>
</jaxws:endpoint>

But I want to to it completely without xml configurations, only by annotation. Is it possible somehow to add an interceptor (which is a spring bean with autowired members) to a @WebService endpoint through the annotation @InInterceptors. Or is there another way?

Community
  • 1
  • 1
Heri
  • 4,368
  • 1
  • 31
  • 51

1 Answers1

0

Unfortunatly nobody could give a hint how to solve this problem through annotations since a year. So I want to inform you how I solved the problem.

My work around is programmatically within an init() method of my services bean:

    GeneratedByWsdl2JavaServices services = new GeneratedByWsdl2JavaServices();
    IGeneratedByWsdl2JavaServices service = services.getBasicHttpBindingIGeneratedByWsdl2JavaServices();
    Client clientProxy = ClientProxy.getClient(service);
    clientProxy.getInInterceptors().add( new ResponseCheckInterceptor() );

Where the IGeneratedByWsdl2JavaServices is the cxf generated implementation and the GeneratedByWsdl2JavaServices the corresponding interface.

Heri
  • 4,368
  • 1
  • 31
  • 51
  • I probably found a solution on: http://stackoverflow.com/questions/10888501/how-to-use-spring-autowired-in-a-custom-cxf-interceptor – Philipp Li Jun 21 '16 at 08:48
  • This is the link I used on the first line of my post, which didn't help at the end. – Heri Jun 21 '16 at 11:57