I have a Jax-Ws Metro project with Spring container. I cannot autowire a field inside SoapHandler. I tried everything from internet resources but no success. The field is always null. Field name is "paymentPortalService".
My Handler class:
public class CustomSoapHeaderHandler extends SpringBeanAutowiringSupport implements SOAPHandler<SOAPMessageContext> {
private static final Logger log = Logger.getLogger(CustomSoapHeaderHandler.class);
@Autowire
private PaymentPortalService paymentPortalService;
}
I have a proxy service which calls a remote service. Added this handler to handlerchain in remote service call method:
@Service
public class CustomServiceProxy {
private final Logger log = Logger.getLogger(CustomServiceProxy.class);
private RemoteServicePort pspPort;
public CustomServiceProxy() {
try {
pspPort = new RemoteService_Service(new URL("https://x?wsdl")).getRemoteServicePort();
Binding binding = ((BindingProvider) pspPort).getBinding();
List<Handler> handlers = binding.getHandlerChain();
handlers.add(new CustomSoapHeaderHandler());
binding.setHandlerChain(handlers);
}
}
I tried to change @Autowire to @Resource and some other solutions from internet, no success. I am using Apache Tomcat 8 without EE container.
Thanks in advance!