2011-10-05 11 views
5

Sto cercando di ottenere "HttpServletRequest" nel metodo "handleMessage" di AxisHandler. Il mio AxisHandler implementa "SOAPHandler" come visto sotto il codice ..Ottenere "HttpServletRequest" in soapMessageContext - Axis Handler

Ho bisogno di ottenere "HttpServletRequest" in "InBoundDirection", ma restituisce "null".

Come posso ottenere "HttpServletRequest" in "InBoundDirection" di SOAPHandler?

grazie ..

@Override 
public boolean handleMessage(SOAPMessageContext soapMessageContext) { 
    boolean direction = ((Boolean) soapMessageContext.get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY)).booleanValue();   
    if (direction) { 
     System.out.println("direction = outbound"); 
    } else { 
     System.out.println("direction = inbound"); 
     HttpServletRequest servletReq=(HttpServletRequest) soapMessageContext.get(MessageContext.SERVLET_REQUEST); 
     // BECAUSE servletReq is null the following line returns a "nullPointerException" 
     System.out.println(servletReq.getRemoteHost()); 
    } 
    return true; 
} 

risposta

0

vedere questo post jax ws getting client ip per una buona spiegazione. Sembra che se si vuole avere un gestore generico (nel mio caso per estrarre il certificato client) è necessario implementare la stessa logica sia per i server web ospitati da EE sia per i contenitori ospitati in SE.

Problemi correlati