2011-12-19 43 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; 
    }