2011-10-05 14 views
5

AxisHandlerの "handleMessage"メソッドで "HttpServletRequest"を取得しようとしています。 私のAxisHandlerは以下のコードのように "SOAPHandler"を実装しています。soapMessageContext - Axis Handlerで "HttpServletRequest"を取得する

"InBoundDirection"で "HttpServletRequest"を取得する必要がありますが、 "null"を返します。

SOAPHandlerの "InBoundDirection"で "HttpServletRequest"を取得するにはどうすればよいですか?

@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; 
} 

答えて

0

は非常に良い説明のため、この記事jax ws getting client ipを参照してください。..ありがとうございます。私の場合、クライアント証明書を抽出するためにジェネリックハンドラが必要な場合は、EEコンテナでホストされるWebサービスとSEホストコンテナの両方に対して同じロジックを実装する必要があります。

関連する問題