在Java中向标头Soap添加令牌

在Java中向标头Soap添加令牌,java,soap,http-headers,token,Java,Soap,Http Headers,Token,我想通过Java向SOAP头添加一个安全令牌。标题应如下所示: <soapenv:Header> <wsse:Security soapenv:actor="http://www.example.com/soap/actor/wssecurity" soapenv:mustUnderstand="1" S12:role="wsssecurity" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-ws

我想通过Java向SOAP头添加一个安全令牌。标题应如下所示:

<soapenv:Header>
<wsse:Security soapenv:actor="http://www.example.com/soap/actor/wssecurity" soapenv:mustUnderstand="1" S12:role="wsssecurity" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:S12="http://www.w3.org/2003/05/soap-envelope">
        <wsse:BinarySecurityToken wsu:Id="SSOToken" ValueType="esquema" EncodingType="wsse:Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">TOKEN_HERE</wsse:BinarySecurityToken>
    </wsse:Security>
</soapenv:Header>

这里有记号吗
当我需要向HTTP头添加用户和密码时,我有以下示例:

Map<String, Object> req_ctx = ((BindingProvider)client).getRequestContext();
req_ctx.put(BindingProvider.USERNAME_PROPERTY, "user");
req_ctx.put(BindingProvider.PASSWORD_PROPERTY, "password");
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("AplicationID", Collections.singletonList("id"));
req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
Map req_ctx=((BindingProvider)客户端).getRequestContext();
req_ctx.put(BindingProvider.USERNAME_属性,“用户”);
req_ctx.put(BindingProvider.PASSWORD_属性,“PASSWORD”);
Map headers=newhashmap();
headers.put(“应用程序id”),Collections.singletonList(“id”);
req_ctx.put(MessageContext.HTTP_请求_头,头);
如何使用与上面代码块相同的方法向标头添加令牌

谢谢