2011-12-19 62 views
1

我正在使用jax-ws調用使用來自JAVA的WS-Security的SOAP服務。 問題是,響應包含一些mustUnderstand標題,我得到一個元素未理解SoapFaultException如何爲{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}添加虛擬SOAPHandler?

響應報頭看起來是這樣的:

<s:Header> 
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
    <u:Timestamp u:Id="_0"> 
     <u:Created>2011-12-19T15:38:49.023Z</u:Created> 
     <u:Expires>2011-12-19T15:43:49.023Z</u:Expires> 
    </u:Timestamp> 
    </o:Security> 

我能添加一個虛擬SOAPHandler爲頭?或者可能將其修改爲mustUnderstand =「0」?如何?

回答

0

錯失重寫getHeaders在handler.Override getHeaders()方法()方法

@Override 
    public Set<QName> getHeaders() { 
     final QName securityHeader = new QName(
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", 
      "Security", 
      "wsse"); 

     final HashSet headers = new HashSet(); 
     headers.add(securityHeader); 

     // notify the runtime that this is handled 
     return headers; 
    }