I have a web project that uses JAX-RPC using SOAP requests and I can't modify it too much. This project is a bit outdated compared to another similar project we are currently maintaining.
I have been trying to get the IP address via the request headers like in our main project by implementing javax.xml.rpc.server.ServiceLifecycle
in my Service Endpoint implementation class. According to this tutorial I should be able to obtain the ServletEndpointContext
via de init method:
public class WebServiceImpl implements ServiceLifecycle {
@Override
public void init(Object context) throws ServiceException {
System.out.println("Initializing...");
ServletEndpointContext ctx = (ServletEndpointContext) context;
}
@Override
public void destroy(){
// TODO
}
}
However, it seems that the init
method is never called and thus I am unable to get the IP from the header.
I have checked against our main project that also uses JAX-RPC and they are almost identical, the only difference being that the main project uses Spring and the Service Endpoint class extends from Spring's ServletEndpointSupport
whilst implementing ServiceLifecycle
.
Is there a certain configuration I need to have in order for this to work?
I have tried using a filter like stated in the tutorial and it seems to be working, however I need to be able to send that IP to my class and not just print it.
Other Details:
- The project is built on WebSphere 7 but runs on a WebSphere 8.5 server
- Using Java 6